【问题标题】:Webpack build fails without printing error informationWebpack 构建失败,没有打印错误信息
【发布时间】:2021-10-08 22:54:36
【问题描述】:

当我在 my project 上运行 npx webpack 时,我收到以下错误:

[webpack-cli] Failed to load '/the/path/to/my/project/webpack.config.babel.js' config
[webpack-cli] TypeError: String.prototype.startsWith called on null or undefined
    at startsWith (<anonymous>)
    at node:internal/errors:811:19
    at Array.filter (<anonymous>)
    at node:internal/errors:809:16
    at prepareStackTrace (node:internal/errors:96:12)
    at Module._extensions..js (node:internal/modules/cjs/loader:1138:38)
    at Object.newLoader [as .js] (/the/path/to/my/project/node_modules/pirates/lib/index.js:104:7)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)

从错误中可以看出,我有一个webpack.config.babel.js 文件和一个.babelrc 文件用于配置。

我已尝试调试构建,但我在异常断点处获得的变量内容信息量不是很大。

看起来我即将收到一条有用的错误消息,但随后返回一个字符串为 null,因此根本没有打印该错误。

【问题讨论】:

    标签: node.js webpack babeljs


    【解决方案1】:

    .babelrc重命名为.babelrc.json,构建成功。

    【讨论】:

      猜你喜欢
      • 2013-01-15
      • 1970-01-01
      • 1970-01-01
      • 2022-11-02
      • 2015-11-05
      • 1970-01-01
      • 1970-01-01
      • 2021-05-07
      • 2021-07-02
      相关资源
      最近更新 更多