reactjs/server-components-demo

Failed to build

Jack-Works opened this issue · 8 comments

Windows 10, Node 15.4.0, NPM 7.0.15

[0] Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: server-components-demo\node_modules\@babel\runtime\helpers\esm\createForOfIteratorHelper.js
[0] require() of ES modules is not supported.
[0] require() of server-components-demo\node_modules\@babel\runtime\helpers\esm\createForOfIteratorHelper.js from server-components-demo\node_modules\marked\src\marked.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
[0] Instead rename createForOfIteratorHelper.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from server-components-demo\node_modules\@babel\runtime\helpers\esm\package.json.
[0]
[0]     at new NodeError (node:internal/errors:278:15)
[0]     at Module._extensions..js (node:internal/modules/cjs/loader:1125:13)
[0]     at Object.newLoader [as .js] (server-components-demo\node_modules\pirates\lib\index.js:104:7)
[0]     at Module.load (node:internal/modules/cjs/loader:973:32)
[0]     at Function.Module._load (node:internal/modules/cjs/loader:813:14)
[0]     at Module.require (node:internal/modules/cjs/loader:997:19)
[0]     at require (node:internal/modules/cjs/helpers:92:18)
[0]     at Object.<anonymous> (server-components-demo\node_modules\marked\src\marked.js:5:58)
[0]     at Module._compile (node:internal/modules/cjs/loader:1108:14)
[0]     at Module._compile (server-components-demo\node_modules\pirates\lib\index.js:99:24) {
[0]   code: 'ERR_REQUIRE_ESM'
[0] }

+1

Does it help if you change

ignore: [/\/(build|server|node_modules)\//],

to

  ignore: [/[\\\/](build|server|node_modules)[\\\/]/],

?

Does it help if you change

ignore: [/\/(build|server|node_modules)\//],

to

  ignore: [/[\\\/](build|server|node_modules)[\\\/]],

?

Something is wrong with this regex, the editor is not liking it.

Apologies, fixed the regex. Try again?

Got it working!

Ok great. Want to send as a PR?

sure

Should be fixed.