webpack 无法识别输出文件名 [英] webpack doesn't recognise output file name

查看:64
本文介绍了webpack 无法识别输出文件名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是我的 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.exportss 结尾.

你的 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.

以下是关于 nodejs 模块加载器的更多详细信息.

Here's some more detail on the nodejs module loader.

这篇关于webpack 无法识别输出文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆