forked from baukh789/GridManager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack-common.loader.js
64 lines (63 loc) · 1.6 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
/**
* @author https://github.com/silence717
* @date on 2017/12/12
*/
const path = require('path');
const ExtractTextWebpackPlugin = require('extract-text-webpack-plugin');
module.exports = (srcCodeDir, idDev) => {
return [
{
test: /\.js$/,
loader: 'eslint-loader',
enforce: 'pre',
exclude: /(node_modules|bower_components)/,
include: path.resolve(__dirname, srcCodeDir + "/js")
},
{
test: /\.js?$/,
loaders: ['babel-loader'],
exclude: /(node_modules|bower_components)/,
include: [path.join(__dirname, srcCodeDir)]
},
{
test: /\.less$/,
exclude: /(node_modules|bower_components)/,
include: [path.join(__dirname, srcCodeDir + '/css')],
use: ExtractTextWebpackPlugin.extract({
use: [{
loader: 'css-loader',
options: {
url: true, // 启用/禁用 url() 处理
minimize: !idDev, // 启用/禁用 压缩
sourceMap: false // 启用/禁用 Sourcemaps
}
},
{
loader: 'resolve-url-loader'
},
{
loader: 'less-loader',
options: {
sourceMap: false // 启用/禁用 Sourcemaps
}
}]
})
},
{
test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/,
loader: 'url-loader?limit=15000&mimetype=application/font-woff&prefix=fonts'
},
{
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
loader: 'url-loader?limit=15000&mimetype=application/octet-stream&prefix=fonts'
},
{
test: /\.eot(\?#\w+)?$/,
loader: 'url-loader?limit=15000&mimetype=application/vnd.ms-fontobject&prefix=fonts'
},
{
test: /\.svg(#\w+)?$/,
loader: 'url-loader?limit=15000&mimetype=image/svg+xml&prefix=fonts'
}
]
};