Commit 82f9cd51 authored by shangbj's avatar shangbj

2-9多种配置类型

parent 81a1e534
### webpack 4引入了生产和开发模式
一个典型的项目可能有:
* 一个用于开发的配置文件,用于定义webpack dev服务器和其他东西
* 用于生产的配置文件,用于定义UglifyJSPlugin和sourcemaps等
* 虽然更大的项目可能仍然需要2个文件,但是在webpack 4中,可以无需任何配置。
```javascript
"scripts": {
"build": "npx webpack --mode production",
"dev": "npx webpack --mode development"
},
```
\ No newline at end of file
console.log('test')
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"name": "2-9",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "npx webpack --mode production",
"dev": "npx webpack --mode development"
},
"author": "",
"license": "ISC",
"devDependencies": {
"webpack": "^4.12.0",
"webpack-cli": "^3.0.3"
}
}
const path = require('path');
module.exports = function(){
return {
entry:'./main.js',
output:{
filename:'./bundle.js',
path:path.resolve(__dirname,'./dist')
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment