-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
38 lines (36 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
const htmlwebpackplugin = require('html-webpack-plugin');
module.exports = {
mode: 'development',
entry: __dirname + '/src/index.js', // src/js 入口文件
// entry: __dirname + '/src_ts/index.ts', // src_ts/ts 入口文件
output: {
path: __dirname + '/dist', // 出口文件
filename: 'index.js'
},
plugins: [
new htmlwebpackplugin({
template: __dirname + '/src/index.html' // 运行入口src/index.html文件
// template: __dirname + '/src_ts/index.html' // 运行入口src_tsindex.html文件
})
],
module: {
rules: [{
test: /\.js$/, // 解析js文件
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['es2015', 'env']
}
}
},
{
test: /\.tsx?$/, // 解析ts文件
use: {
loader: 'ts-loader'
}
}
]
},
devtool: 'source-map' // js文件编译
};