reactjs/server-components-demo

Can't use destructuring assignment in server code

penx opened this issue · 0 comments

penx commented

As mentioned (in more detail) at facebook/react#23126 (comment)

If you use destructuring assignment in a server component, you get a babel error:

/server-components-demo/src/App.server.js:141
undefined
      ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /server-components-demo/node_modules/@babel/runtime/helpers/esm/slicedToArray.js from /server-components-demo/src/App.server.js not supported.
Instead change the require of slicedToArray.js in /server-components-demo/src/App.server.js to a dynamic import() which is available in all CommonJS modules.