Browse Source

chore: 去除worker中css less的引用

es6
iapyang 2 years ago
parent
commit
35ebf87744
  1. 0
      plugins/webpack-fui-worker-plugin/empty.js
  2. 17
      plugins/webpack-fui-worker-plugin/worker-loader.js

0
plugins/webpack-fui-worker-plugin/empty.js

17
plugins/webpack-fui-worker-plugin/worker-loader.js

@ -68,9 +68,20 @@ function loader() {
}).apply(childCompiler);
// 去除源码中的less css引用
new webpack.IgnorePlugin({
resourceRegExp: /\.(css|less)$/,
}).apply(childCompiler);
const regExp = /\.(css|less)$/;
new webpack.NormalModuleReplacementPlugin(
regExp,
result => {
if (regExp.test(result.request)) {
result.request = resolve(__dirname, './empty.js');
}
if (regExp.test(result.resource)) {
result.resource = resolve(__dirname, './empty.js');
}
},
).apply(childCompiler);
const subCache = `subcache ${__dirname} ${workerEntry}`;
childCompiler.hooks.compilation.tap(WorkerLoaderName, compilation => {

Loading…
Cancel
Save