forked from baukh789/GridManager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack-common.loader.js
106 lines (105 loc) · 2.98 KB
/
webpack-common.loader.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = () => {
return [
{
enforce: 'pre',
test: /\.js$/,
include: [path.join(__dirname, 'src')],
exclude: /node_modules/,
use: [
{
loader: 'eslint-loader',
options: {
formatter: require('eslint-friendly-formatter')
}
}
]
},
{
test: /\.js$/,
exclude: /node_modules/,
use: ['babel-loader']
},
{
test: /\.(le|c)ss/,
include: [path.join(__dirname, 'src')],
use: [
{
loader: MiniCssExtractPlugin.loader
},
{
loader: 'css-loader',
options: {
url: true, // 启用/禁用 url() 处理
sourceMap: true // 启用/禁用 Sourcemaps
}
},
{
loader: 'resolve-url-loader'
},
{
loader: 'less-loader',
options: {
sourceMap: false // 启用/禁用 Sourcemaps
}
}
]
}, {
test: /\.html$/,
use: [path.join(__dirname, './webpack-loaders/html-clear-loader.js'), 'html-loader'],
include: [path.join(__dirname, 'src')],
exclude: /(node_modules|bower_components)/
}, {
test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/,
use: [
{
loader: 'url-loader',
options: {
limit: 10000,
mimetype: 'application/font-woff'
}
}
]
}, {
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
use: [
{
loader: 'url-loader',
options: {
limit: 10000,
mimetype: 'application/octet-stream'
}
}
]
}, {
test: /\.otf(\?v=\d+\.\d+\.\d+)?$/,
use: [
{
loader: 'url-loader',
options: {
limit: 10000,
mimetype: 'application/font-otf'
}
}
]
}, {
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
use: [
{
loader: 'file-loader'
}
]
}, {
test: /\.(jpe?g|png|gif|svg)$/i,
use: [
{
loader: 'file-loader',
options: {
name: '[path][name]-[hash:8].[ext]'
}
}
]
}
];
};