-
Notifications
You must be signed in to change notification settings - Fork 39
/
webpack-common-loaders.js
64 lines (63 loc) · 1.33 KB
/
webpack-common-loaders.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
* @Author: fang.yang
* @Date: 2019-12-18 09:47:13
* @Description: [只用于 karma 测试使用]
*/
var path = require('path');
module.exports = {
module: {
rules: [
{
test: /\.js$/,
loaders: ['babel-loader'],
exclude: /(node_modules|bower_components)/
},
{
test: /\.js$/,
enforce: 'pre',
use: [{
loader: 'eslint-loader',
options: {
emitWarning: true,
emitError: true,
formatter: require('eslint-friendly-formatter')
}
}],
exclude: /node_modules/,
include: [path.join(__dirname, 'src')]
},
{
test: /\.tpl\.html$/,
use: {
loader: 'html-loader',
options: {
interpolate: true
}
},
exclude: /(node_modules|bower_components)/
},
{
test: /\.(jpe?g|png|gif)$/i,
loaders: [
'url-loader?limit=1000'
]
},
{
test: /\.(woff|woff2)(\?t=\d+)?$/,
loader: 'url-loader?limit=10000&mimetype=application/font-woff&prefix=fonts'
},
{
test: /\.ttf(\?t=\d+)?$/,
loader: 'url-loader?limit=10000&mimetype=application/octet-stream&prefix=fonts'
},
{
test: /\.eot(\?t=\d+)?$/,
loader: 'url-loader?limit=10000&mimetype=application/vnd.ms-fontobject&prefix=fonts'
},
{
test: /\.svg(\?t=\d+)?$/,
loader: 'url-loader?limit=10000&mimetype=image/svg+xml&prefix=fonts'
}
]
}
};