Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError loading webpack.config.js in ESM project with node v16.6 #2864

Closed
olizilla opened this issue Jul 31, 2021 · 3 comments
Closed

TypeError loading webpack.config.js in ESM project with node v16.6 #2864

olizilla opened this issue Jul 31, 2021 · 3 comments
Labels

Comments

@olizilla
Copy link

I think this change nodejs/node#39175 in node 16.6 means the webpack.config.js is loading is broken for ESM projects.

Our CI started failing once node 16.6 got rolled out with:

$ npm run build

> @web3-storage/api@3.1.1 build
> webpack

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 Object.Module._extensions..js (node:internal/modules/cjs/loader:1138:38)
    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)

Setting WEBPACK_CLI_FORCE_LOAD_ESM_CONFIG=true fixed it, but it seems like a workaround.

see:

(error.code === "ERR_REQUIRE_ESM" ||
process.env.WEBPACK_CLI_FORCE_LOAD_ESM_CONFIG) &&

see: nodejs/node#39175
see: nodejs/node@e2a6399#r54198959

@olizilla olizilla added the Bug label Jul 31, 2021
@olizilla
Copy link
Author

reported in: nodejs/node@e2a6399#r54198959

add your +1 on this comment to vote to fast track the fix nodejs/node#39593 (comment)

@olizilla
Copy link
Author

it's already landed! Noice!

@alexander-akait
Copy link
Member

Fixed in Node.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants