本文介绍了我怎样才能让 webpack 跳过一个要求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何让 webpack 跳过
How can I make webpack skip occurences of
require('shelljs/global');
在我的源文件中?我想打包我的源文件,但将 require('shelljs/global')
保留在文件中,而不是捆绑 shelljs/global
.
in my source files? I want to make a bundle of my source files but keep the require('shelljs/global')
in the files and not bundle shelljs/global
.
推荐答案
如果您将路径存储在变量中,则 IgnorePlugin 将不起作用.虽然你仍然可以这样做:
If you store the path in a variable then IgnorePlugin will not work. Though you still could do:
const myCustomModule = eval('require')(myCustomPath)
这篇关于我怎样才能让 webpack 跳过一个要求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!