【发布时间】:2017-07-11 14:21:05
【问题描述】:
我使用文件加载器自动将一堆 pug 模板渲染为静态 html 文件,但 webpack 也基于入口点输出了一个毫无意义的文件
例如,这是在我的 webpack.config.js 中:
entry: {
'js/build/bundle.js': './js/app.js',
'this-shouldnt-emit': './pug/.pug.js' //pug entry point
},
output: {
path: path.join(__dirname, '../'),
filename: '[name]'
},
...
// pug loading module rule
{
test: /\.pug$/,
include: path.resolve(__dirname, "../pug"),
use: [
"file-loader?name=[path][name].html&context=./pug",
"pug-html-loader?pretty&exports=false"
]
}
我在根构建目录中获得了一个 this-shouldnt-emit 捆绑文件,这是我不想要的。
如何阻止文件加载器发出输出包,但又不干扰它生成当前的所有静态 html 文件。是否有一个插件或某种空加载器我可以放在加载器链的末尾来终止捆绑发射?
【问题讨论】:
-
简单的方法是在构建后删除它)
标签: javascript node.js webpack pug-loader