-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.test.config.js
42 lines (42 loc) · 1.09 KB
/
webpack.test.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
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: path.resolve(__dirname, './src/test/index.js'), //指定入口文件,程序从这里开始编译,__dirname当前所在目录, ../表示上一级目录, ./同级目录
output: {
path: path.resolve(__dirname, 'test'), // 输出的路径
filename: 'test.js' // 打包后文件
},
resolve: {
extensions: ['*', '.js', '.jsx', '.ts', '.tsx']
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
loader: 'babel-loader',
exclude: /node_modules/
},
{
enforce: 'pre',
test: /\.(js|jsx|ts|tsx)$/,
loader: 'eslint-loader',
exclude: /node_modules/,
},
{
test: /\.(ts|tsx)$/,
loader: 'ts-loader',
exclude: /node_modules/
},
{
test: /\.less$/,
use: ['style-loader', 'css-loader', 'less-loader']
},
],
},
plugins: [
new HtmlWebpackPlugin({
template: path.resolve(__dirname, './src/test/index.html'),
inject: true
})
]
}