I have an app with 2 bundles, and common modules e.g. react
are extracted into a vendor bundle. I am adding a 3rd bundle which I don't want to extract common dependancies from. Is this possible.
This question is related to this one however that is about creating multiple vendor bundles for each entry point, whereas I want one of the bundles to not require vendor. In my case it is because the script is a simple site verification script which is being set in the head, so will be before the vendor
bundlde. However I still want to be able to use modules in this head
bundle.
const webpack = require('webpack');
const path = require('path');
const config = {
entry: {
vendor: [
'jquery',
'react',
'react-dom'
],
main: [
'./bundles/main/App',
],
cms: [
'./bundles/cms/App'
],
head: [
'./bundles/head/App'
],
},
output: {
filename: '[name]-bundle.js',
path: '../app/assets/webpack',
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
filename: 'vendor-bundle.js',
minChunks: Infinity,
})
],
module: {
loaders: [
{test: /\.jsx?$/, loader: 'babel-loader', exclude: /node_modules/},
],
},
};
module.exports = config;