-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
41 lines (40 loc) · 1.26 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
const webpack = require('webpack');
module.exports = function(webpackConfig, env) {
webpackConfig.module.rules = webpackConfig.module.rules.map((rule) => {
if (!rule.use) return rule;
rule.use = rule.use.map((loaderOption) => {
if (loaderOption.loader && loaderOption.loader.indexOf('/css-loader/') > -1) {
return {
loader: require.resolve('typings-for-css-modules-loader'),
options: {
modules: true,
namedExport: true,
camelCase: true,
minimize: true,
localIdentName: '[local]_[hash:base64:5]',
...loaderOption.options,
},
};
}
if (typeof loaderOption === 'string' && loaderOption.indexOf('/style-loader/') > -1) {
return {
loader: require.resolve('style-loader'),
};
}
return loaderOption;
});
return rule;
});
webpackConfig.plugins.push(new webpack.WatchIgnorePlugin([/less\.d\.ts$/]));
// console.log(webpackConfig);
// sleep(11000000);
// function sleep(milliseconds) {
// var start = new Date().getTime();
// for (var i = 0; i < 1e7; i++) {
// if (new Date().getTime() - start > milliseconds) {
// break;
// }
// }
// }
return webpackConfig;
};