-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
Hello, when we upgraded from v4 to v5, we found that the default location for inserting js has changed. Can you tell me why this change was made
v4:
v5:
webpack config:
`const HtmlWebpackPlugin = require("html-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
module.exports = {
mode: "production",
entry: ["./src/index.js"],
output: {
filename: "[name].[hash:8].js",
clean: true,
},
module: {
rules: [
{
test: /.css$/,
use: [MiniCssExtractPlugin.loader, "css-loader"],
exclude: /node_modules/,
},
{
test: /.js$/,
use: ["babel-loader"],
exclude: /node_modules/,
},
],
},
optimization: {
splitChunks: {
cacheGroups: {
commons: {
test: /[\/]node_modules[\/]/,
name: "vendors",
chunks: "all",
},
},
},
},
plugins: [
new HtmlWebpackPlugin(),
new MiniCssExtractPlugin(),
],
};
`