webpack 无法识别输出文件名 [英] webpack doesn't recognise output file name
问题描述
以下是我的 webpack.config.js.我已经指定了一个输出文件名,但我仍然收到错误 throw new Error("'output.filename' is required, 无论是在配置文件中还是作为 --output-filename")
Following is my webpack.config.js. I have specified an output file name but I still get error throw new Error("'output.filename' is required, either in config file or as --output-filename")
/public 是否需要存在或 webpack 会创建一个?
Does /public director need to exist or will webpack create one?
module.export = {
entry: [
'/ts/main.ts',
'/ts/vendor.ts'
],
output:{
path: __dirname+'/public',
filename:'[name].bundle.js'
},
rules:
{
test:'/\.ts$/',
loader:'awesome-typescript-loader'
}
}
推荐答案
module.exports
以 s
结尾.
你的 module
正在加载,但是 webpack 没有找到任何东西(即你的配置)exported,所以没有加载 output
并且永远不会看到 filename
结果.
Your module
is loading, but webpack doesn't find anything (i.e., your configuration) exported, so doesn't load output
and never sees filename
as a result.
Here's some more detail on the nodejs module loader.
这篇关于webpack 无法识别输出文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!