commonschunkplugin

De-Duplicate libraries in app within deeply nested node modules

☆樱花仙子☆ 提交于 2020-01-03 04:51:14
问题 I have a app in which i can add modules as node_modules. Now, these modules and app uses a library XYZ as node module. Also, these modules have other node modules which has their own library XYZ as a node module. So, this is roughly how the structure of my app looks like I use gulp and webpack and i am trying to some how de-duplicate library XYZ. I want to build a task that would go through this nested tree of node modules and build out 1 common version of library XYZ. How can I achieve that?

Webpack 2 - Suppress chunk files

可紊 提交于 2019-12-24 06:04:44
问题 As we are putting this output on a load balancer (not using sticky), we need to place the output of these files without chunks (neither hashes). These are the main two files for webpack configuration. webpack.common.js const path = require('path'); const webpack = require('webpack'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const ExtractTextPlugin = require('extract-text-webpack-plugin'); const helpers = require('./helpers'); const STATIC_TRANSLATION_MAP = require('..

Apply CommonsChunkPlugin on different config exports in Webpack?

北城余情 提交于 2019-12-23 09:29:07
问题 I am working on a project which is consisting of the following 'entities': A few pages for a static website An app An admin dashboard In my initial webpack.config a setup I was handling each of these entities as different entry points. For example, I would have something like entry: { vendor: [ 'jquery', 'bootstrap', 'bootstrap/dist/css/bootstrap.css' ], admin: [ 'admin.js', 'admin.css' ], websitePageA: [ 'analytics.js', 'websitePageA.js', 'websitePageA.css' ], websitePageB: [ 'analytics.js',

Split “vendor” chunk using webpack 2

好久不见. 提交于 2019-12-14 03:56:50
问题 I have code splitting config similar to official docs and everything works perfect - all my node modules are in "vendor" chunk (including "babel-polyfill"). But now I need to move babel-polyfill and all it's dependecies to separate chunk ("polyfills") to be able to load it before my vendor bundle. Any ideas how to do that? My config: ... entry: { main: './index.jsx' }, ... new webpack.optimize.CommonsChunkPlugin({ name: 'vendor', minChunks: function (module) { return module.context && module

Webpack: extract common modules from entry and child chunks to separate commons chunk

99封情书 提交于 2019-12-12 10:38:15
问题 I have an application built with webpack that uses code splitting. I now want to aggregate all common modules that match specific criteria (in this case node_modules ) across all entry chunks and all child chunks (generated via code splitting) into a single separate commons chunk. If I do this: new webpack.optimize.CommonsChunkPlugin({ children: true, async: 'vendor', minChunks: (module) => { const isVendor = module.context.split('/').some(dir => dir === 'vendor'); return isVendor; }, }),

What's the difference between “names” and “chunks” in CommonsChunkPlugin?

心已入冬 提交于 2019-12-11 11:04:46
问题 What's the difference between those two fields in plugins options? How are they related to each other? Which one is executed first, which one second? How can I pick a package from a chunk info a separate file with these options? name: string, // or names: string[], chunks: string[], What does highlighted text below mean for chunks: string[] option? How to read child in that context? // Select the source chunks by chunk names. The chunk must be a child of the commons chunk. // If omitted all

CommonsChunkPlugin doesn't work with electron

蓝咒 提交于 2019-12-11 08:17:07
问题 I have an electron app that I'm building with Webpack 2. I have a custom module ( mymodule ) that I want to be a separate bundle referenced by the other bundles. The problem is that when I use the CommonsChunkPlugin with my main process, electron locks up as the app is starting. I can see the electron logo appear in the doc but the window never shows up. Note that it doesn't have to be a module I wrote, I can use lodash with CommonsChunkPlugin and get the same result. Interestingly, if I use

Webpack missing modules with CommonsChunk and extract-text-webpack-plugin

有些话、适合烂在心里 提交于 2019-12-11 00:13:36
问题 I'm following Maxime Fabre's tutorial on Webpack and am trying to get a really simple webpack bundle with 1 entry point and 2 chunks to work. Since both chunks require jquery and mustache, I'm using CommonsChunkPlugin to move the common dependencies up to the main bundle file, just like in the tutorial. I'm also using extract-text-webpack-plugin to extract styles from the chunks and put them in a separate CSS file. My webpack.config.js: var ExtractPlugin = require("extract-text-webpack-plugin

Webpack migration 3 -> 4: Error: Cannot find module 'webpack/lib/optimize/CommonsChunkPlugin'

空扰寡人 提交于 2019-12-10 18:31:18
问题 I'm trying to migrate from webpack 3 to webpack 4. The issue I have is with CommonsChunkPlugin, when I try to run webpack ( npm run webpack-dev-server -- --config config/webpack.dev.js ), I have the following error: module.js:529 throw err; ^ Error: Cannot find module 'webpack/lib/optimize/CommonsChunkPlugin' at Function.Module._resolveFilename (module.js:527:15) at Function.Module._load (module.js:476:23) at Module.require (module.js:568:17) at require (internal/module.js:11:18) at Object.

Webpack - React Router V4 - code splitting duplicate modules in async chunks

我们两清 提交于 2019-12-10 10:08:55
问题 The main problem is while code splitting with react-routerV4 and then webpack 2, I have modules that are in several chunks that I can't get to the main one. My configuration is as follow : Webpack 2.2.1 React-route 4.1.1 I'm using the code splitting as in the react-router v4 documentation Basically, I don't use the import, but on the route configuration I have : something like this : import loadHome from 'bundle-loader?lazy&name=home-chunk!./pages/market/Home'; [ { path: url1, component: