-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
39 lines (38 loc) · 1.11 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
entry: {
main: './main.js'
},
output: {
filename: '[name].js',
path: __dirname + '/dist'
},
// devtool: '',
mode: 'development',
optimization: {
minimize: false
},
module: {
rules: [
{
test: /\.js$/,
use: {
loader: 'babel-loader', // 所有的以js结尾的文件都要通过babel-loader 进行转义为就的js语言
options: {
// todo bable 里面 presets 和 plugins 的区别
presets: ['@babel/preset-env'],
plugins: [
['@babel/plugin-transform-react-jsx', {pragma: 'createElement'}] // pragma 又是什么呢? 是一个 语法糖 用于替换 React.createElement
]
}
}
}
]
},
plugins: [
new HtmlWebpackPlugin({
template: './main.html',
filename: 'main.html'
}),
]
}