I upgraded webpack from version 2 to version 4. My config includes:
entry = {
Main: './main',
App: './app'
};
and
var output = {
path: path.join(__dirname, outPath, '_js'),
publicPath: '/_js/',
filename: '[name]-bundle.js'
};
In version 2, my output was simply App-bundle.js
and Main-bundle.js
, but in webpack@4 the output is
Entrypoints:
Main (414 KiB)
Main~493df0b3-bundle.js
Main~4c0201b9-bundle.js
App (316 KiB)
App~47dad47d-bundle.js
App~6bd0612f-bundle.js
App~01e7b97c-bundle.js
without a central, non-hashed file name to import.
EDIT:
My optimization
object looks like this:
optimization: {
splitChunks: {
chunks: 'async',
minSize: 20000,
maxSize: env === 'production' ? 1000000 : 0,
minChunks: 1,
maxAsyncRequests: 6,
maxInitialRequests: 4,
automaticNameDelimiter: '~',
cacheGroups: {
default: {
minChunks: 1,
priority: -20,
reuseExistingChunk: true
}
}
},
minimize: env === 'production' ? true : false
},
--- QUESTION ---
I'm ok having chunks, but how do I configure webpack 4 in order to have a central entry file called simply Main-bundle.js
and App-bundle.js
that I can easily import in my HTML templates?