commonschunkplugin

webpackJsonp is not defined: webpack-dev-server and CommonsChunkPlugin

孤街浪徒 提交于 2019-12-06 22:30:34
问题 This is my webpack.config.js file: const webpack = require('webpack'); const path = require('path'); module.exports = { cache: true, devtool: 'source-map', entry: { app : [ './src/index.js' ], vendor: ['lodash'] }, output: { filename: 'bundle.js', path: path.join(__dirname, 'dist'), publicPath: '/dist/', pathinfo: true }, module: { loaders: [ { test: /\.js$/, exclude: /node_modules/, loaders: ['babel'] }, { test: /\.scss/, exclude: /node_modules/, loaders: ['style', 'css', 'sass'] } ] },

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

梦想的初衷 提交于 2019-12-05 20:08:10
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: props => <Bundle load={loadHome}>{Home => <Home {...props} />}</Bundle>, exact: true, }, // other routes ]

webpackJsonp is not defined: webpack-dev-server and CommonsChunkPlugin

≯℡__Kan透↙ 提交于 2019-12-05 05:14:57
This is my webpack.config.js file: const webpack = require('webpack'); const path = require('path'); module.exports = { cache: true, devtool: 'source-map', entry: { app : [ './src/index.js' ], vendor: ['lodash'] }, output: { filename: 'bundle.js', path: path.join(__dirname, 'dist'), publicPath: '/dist/', pathinfo: true }, module: { loaders: [ { test: /\.js$/, exclude: /node_modules/, loaders: ['babel'] }, { test: /\.scss/, exclude: /node_modules/, loaders: ['style', 'css', 'sass'] } ] }, plugins: [ new webpack.NoErrorsPlugin(), new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.bundle

Can someone explain Webpack's CommonsChunkPlugin

余生颓废 提交于 2019-12-04 07:22:07
问题 I get the general gist that the CommonsChunkPlugin looks at all the entry points, checks to see if there are common packages/dependencies between them and separates them into their own bundle. So, let's assume I have the following configuration: ... enrty : { entry1 : 'entry1.js', //which has 'jquery' as a dependency entry2 : 'entry2.js', //which has 'jquery as a dependency vendors : [ 'jquery', 'some_jquery_plugin' //which has 'jquery' as a dependency ] }, output: { path: PATHS.build,

Webpack 4 migration CommonsChunkPlugin

爱⌒轻易说出口 提交于 2019-11-27 11:47:28
I need help migrating the following code from webpack 3 to 4. new webpack.optimize.CommonsChunkPlugin({ minChunks: module => module.context && module.context.indexOf("node_modules") !== -1, name: "vendor", chunks: ["main"] }) I have two entry files and want only the dependencies of the first one to be included in the vendor chunk. The dependencies of the second entry should all stay in its own bundle. Legends As of webpack v4 the CommonsChunkPlugin is deprecated. We have deprecated and removed CommonsChunkPlugin, and have replaced it with a set of defaults and easily overridable API called

Webpack 4 migration CommonsChunkPlugin

℡╲_俬逩灬. 提交于 2019-11-26 22:20:50
问题 I need help migrating the following code from webpack 3 to 4. new webpack.optimize.CommonsChunkPlugin({ minChunks: module => module.context && module.context.indexOf("node_modules") !== -1, name: "vendor", chunks: ["main"] }) I have two entry files and want only the dependencies of the first one to be included in the vendor chunk. The dependencies of the second entry should all stay in its own bundle. 回答1: As of webpack v4 the CommonsChunkPlugin is deprecated. We have deprecated and removed