I'm trying to import a large file into a react project that is Chunked and Uglified by webpack 2.
Our code is split into chunks one of our chunks is 29MG. I want to exclude the large file from the chuck and to load that large file separately.
How do could I split the large file to it's own chunk with webpack 2?
my files
reactComponent imports a js file that has code to export the page to a PDF
reactComponent.js -> import createPDF.js
in createPDF I import a file that is very large and that file I want to split out of the check. that file isn't under node_modules.
createPDF.js -> import largeFile.js
Some of my webpack config
entry: {
vendor: [
'react',
'react-dom',
'lodash',
'moment',
'underscore',
'redux-thunk',
'react-bootstrap-table',
'react-bootstrap-daterangepicker',
'react-bootstrap-multiselect',
'react-bootstrap',
'react-translate-component'
],
app: [ './index.js' ]
},
plugins: [
// compresses the JS
new webpack.optimize.UglifyJsPlugin({
exclude: /^2(.*?)\.js$/i, // exclude the very large file
compress: { warnings: false },
sourceMap: true
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks: Infinity,
filename: '[name].[hash].js'
}),
],
is the a way that i could split out that one file? TIA!