webpack4 配置
安装 webpack4 yarn add webpack webpack-cli -D 新建 webpack.config.js const path = require('path'); module.exports = { entry: './src/index.js', output: { filename: 'main.js', path: path.resolve(__dirname, 'dist') } }; package.json { "name": "webpack-demo", "version": "1.0.0", "description": "webpack demo project", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "build": "webpack" // 增加 }, "author": { "name": "wubh2012" }, "license": "MIT", "devDependencies": { "webpack": "^4.39.2", "webpack-cli": "^3.3.6" } } 使用 命令 yarn build 或 npx run build 运行 处理 CSS, sass,