Open Skn0tt opened 8 months ago
@mongolyy I prereleased this as v0.4.6-0
, could you check if that fixes your problem before we release this?
@Skn0tt Thanks for the improvement.
Unfortunately, however, my application fails with an error when I run the next build
or next dev
command.
I am attaching a terminal log from when I ran the next build
command.
$ next build
✓ Linting and checking validity of types
Disabled SWC as replacement for Babel because of custom Babel configuration ".babelrc" https://nextjs.org/docs/messages/swc-disabled
Using external babel configuration from C:\Users\mongolyy\repos\next-app\app\.babelrc
Failed to compile.
./src/pages/_app.tsx
Error: [BABEL]: You appear to be using a native ECMAScript module plugin, which is only supported when running Babel asynchronously. (While processing: C:\Users\mongolyy\repos\next-app\app\node_modules\babel-plugin-superjson-next\dist\index.js)
at loadCjsOrMjsDefault (C:\Users\mongolyy\repos\next-app\app\node_modules\next\dist\compiled\babel\bundle.js:1:35044)
at loadCjsOrMjsDefault.next (<anonymous>)
at requireModule (C:\Users\mongolyy\repos\next-app\app\node_modules\next\dist\compiled\babel\bundle.js:1:41464)
at requireModule.next (<anonymous>)
at loadPlugin (C:\Users\mongolyy\repos\next-app\app\node_modules\next\dist\compiled\babel\bundle.js:1:38200)
at loadPlugin.next (<anonymous>)
at createDescriptor (C:\Users\mongolyy\repos\next-app\app\node_modules\next\dist\compiled\babel\bundle.js:1:23608)
at createDescriptor.next (<anonymous>)
at evaluateSync (C:\Users\mongolyy\repos\next-app\app\node_modules\next\dist\compiled\babel\bundle.js:1910:740999)
at C:\Users\mongolyy\repos\next-app\app\node_modules\next\dist\compiled\babel\bundle.js:1910:738372
However, I think this can be worked around by babel configuration, so I will try trial and error. I will comment here if I make progress. If you have any advice, I would appreciate it.
Closes https://github.com/blitz-js/babel-plugin-superjson-next/issues/145.
The code we were compiling into
dist
was CJS, not ESM. But when the user installed SuperJSON 2, which is ESM-only, it triedrequire
-ing it. That failed, see #145. This PR fixes that, by making this package (including/tools
) an ESM package as well.