diff --git a/2019/12/webpack.md b/2019/12/webpack.md index 11e5463..70a06c0 100644 --- a/2019/12/webpack.md +++ b/2019/12/webpack.md @@ -39,4 +39,36 @@ linux 系统 运行 yarn global bin 查看 yarn 的全局目录,然后 #expor index.js 要压缩的js文件 package.json 应用的默认配置 >内容: - webpack.config \ No newline at end of file + ``` + { + "name": "ceshi", + "version": "1.0.0", + "description": "wu", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "build": "webpack --mode production", + "dev": "webpack --mode development" + }, + "author": "aaa", + "license": "3000", + "private": false +} +``` + + webpack.config.js + >内容: + ``` +const path = require('path'); +module.exports = { + // 入口js路径 + entry: './src/index.js', + // 编译输出的js及路径 + output: { + filename: 'bundle.js', + path: path.resolve(__dirname, 'dist') + } +}; + + + ``` \ No newline at end of file