安装插件:
yarn add webpack-merge-and-include-globally -D
webpack.config.js
const path = require("path");
const MergeIntoSingleFilePlugin = require('webpack-merge-and-include-globally');
module.exports = {
mode: 'none',
entry: path.resolve(__dirname, "src/main.js"),
module: {
},
plugins: [
new MergeIntoSingleFilePlugin({
files: {
"min/js/bundle.js": [
path.resolve(__dirname, "src/js/count.js"),
path.resolve(__dirname, "src/js/sum.js")
],
"min/css/bundle.css": [
path.resolve(__dirname, 'src/css/index.css'),
path.resolve(__dirname, 'src/css/index2.css')
]
}
}),
],
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].js'
}
}
标签:__,Webpack5,resolve,js,globally,merge,path,dirname,css
From: https://www.cnblogs.com/fanfan-90/p/18496230