-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.config.js
45 lines (42 loc) · 946 Bytes
/
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
40
41
42
43
44
45
/**
*
* @authors ZiQiangWang
* @email [email protected]
* @date 2017-08-01 23:21:12
*/
const path = require('path');
const htmlWebpackPlugin = require('html-webpack-plugin');
// 定义路径
const PATHS = {
src: path.resolve(__dirname, 'src'),
dist: path.resolve(__dirname, 'dist'),
node_modules: path.resolve(__dirname, 'node_modules')
};
module.exports = {
mode: 'development',
entry: './example/index',
module: {
rules: [
{
test: /\.jsx$/,
use: ['babel-loader'],
exclude: PATHS.node_modules,
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
},
]
},
plugins: [
// html文件导出,这里的将文件导出到根目录
new htmlWebpackPlugin({
template: './example/index.html',
filename: 'index.html',
inject: 'body',
})
],
resolve: {
extensions: ['.js','.jsx'] //后缀名自动补全
}
}