//webpack-config.js
const path = require('path'); module.exports = { mode: 'none', entry: './src/index.js', output: { filename: 'bundle.js', path: path.resolve(__dirname, '../dist') } };
在package.json 中scripts 增加
"build": "webpack --mode production ./src/index.js --output ./dist/bundle.js"
"dev": "webpack --mode development ./src/index.js --output ./dist/bundle.js"