In the generated js file, the files are not glued in the order they are transferred in the array.
How to correctly specify the order of files connection??
const path = require('path');
module.exports = {
context: path.join(__dirname, "/public/src/js/entry/"),
entry: {
base: [
'./js/lib/jquery/jquery-1.11.1.min.js',
'./js/lib/jquery/jquery-migrate-1.2.1.min.js',
'./js/lib/jquery/jquery.placeholder.min.js,' +
'./js/base/subscribe-mailing.js'
],
indexPage: './indexPage.entry.js',
},
output: {
path: path.resolve(__dirname, 'public/dist/js'),
filename: '[name].js',
publicPath: "public/dist/js"
},
module: {
rules: [
{
test: /\.js$/,
loader: 'babel-loader',
exclude: '/node_modules/'
},
{
test: /\.css$/,
use: [
'babel-loader',
'css-loader'
]
}
]
},
};
as a result, I need a single file with the connected ones in the order in which they are passed in the array
Not everyone uses React... I needed to Minify CSS/JS files myself in my old projects. Solution it's easy, just in webpack.config.js:
optimization: {
moduleIds: 'natural'
}
The order will be as specified in entry index.js The other useful settings here https://webpack.js.org/configuration/optimization/#optimizationmoduleids
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With