【发布时间】: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,因此根本没有打印该错误。
【问题讨论】: