-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
50 lines (49 loc) · 1.24 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
40
41
42
43
44
45
46
47
48
49
50
/*
* @Description: In User Settings Edit
* @Author: your name
* @Date: 2019-09-19 09:47:22
* @LastEditTime: 2019-09-20 16:55:36
* @LastEditors: Please set LastEditors
*/
const path = require('path');
module.exports = {
context: path.resolve(__dirname),
mode: process.env.NODE_ENV,
devtool: global.IS_PROD ? false : 'cheap-module-source-map',
watch: !global.IS_PROD,
watchOptions: {
poll: 1000
},
output: {
filename: '[name].js'
},
module: {
rules: [
{
test: /\.m?js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader' // babel有单独的配置文件 babel.config.js
}
},
{
test: /\.(vue|js)$/,
loader: 'eslint-loader', // js规则检查参考 https://github.com/standard/standard/blob/master/docs/RULES-zhcn.md
exclude: /(node_modules|bower_components)/,
// include: [resolve('app'), resolve('.tmp')],
enforce: 'pre',
options: {
formatter: require('eslint-friendly-formatter')
}
},
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /(node_modules|bower_components)/
}
]
},
resolve: {
extensions: [ '.tsx', '.ts', '.js' ]
}
};