Can't transpile a babel macro project
See original GitHub issueRun next info
(available from version 12.0.8 and up)
next info
is still not available, but I run npx envinfo --binaries --system
:
System:
OS: macOS 12.0.1
CPU: (10) arm64 Apple M1 Pro
Memory: 76.88 MB / 32.00 GB
Shell: 3.3.1 - /opt/homebrew/bin/fish
Binaries:
Node: 16.13.1 - ~/.local/share/nvm/v16.13.1/bin/node
Yarn: 1.22.17 - /opt/homebrew/bin/yarn
npm: 8.1.2 - ~/.local/share/nvm/v16.13.1/bin/npm
What version of Next.js are you using?
12.0.8-canary.16
What version of Node.js are you using?
v16.13.1
What browser are you using?
Chrome
What operating system are you using?
macOS
How are you deploying your application?
Vercel
Describe the Bug
For some reason, Next.js can’t transpile .macro
files.
The terminal is reporting something related to an uid
, looks like an internal thing:
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info - Disabled SWC as replacement for Babel because of custom Babel configuration ".babelrc" https://nextjs.org/docs/messages/swc-disabled
event - compiled client and server successfully in 152 ms (144 modules)
wait - compiling / (client and server)...
info - Using external babel configuration from /Users/kikobeats/Downloads/with-babel-macros-app/.babelrc
error - ./pages/index.js
TypeError: Cannot read properties of undefined (reading 'uid')
(node:13611) [DEP_WEBPACK_MODULE_ISSUER] DeprecationWarning: Module.issuer: Use new ModuleGraph API
(Use `node --trace-deprecation ...` to show where the warning was created)
wait - compiling /_error (client and server)...
error - ./pages/index.js
TypeError: Cannot read properties of undefined (reading 'uid')
I think what is happening is since the macro file is called *.macro.js
, Next.js is wrongly interpreting it instead of leveraging to babel-plugin-macros for doing the job.
Expected Behavior
The macro should be interpreted by the babel plugin, not being interfered with by the Next.js internal compiler.
To Reproduce
just clone with-babel-macros
Issue Analytics
- State:
- Created 2 years ago
- Comments:14 (10 by maintainers)
Top Results From Across the Web
Zero-config code transformation with babel-plugin-macros
I have a few problems with Babel plugins though: They can lead to confusion because when looking at code in a project, you...
Read more >Error when trying to run application with babel-plugin-relay ...
I have set everything up with Yarn workspaces (version berry) and Webpack 5. When I'm trying to run one of my apps, I...
Read more >Untitled
Code that is run by preval is not transpiled so it must run natively in the ... For example: ```javascript import preval from...
Read more >client/node_modules/babel-plugin-macros - gitlab@IfI - UZH
Unfortunately you'll also experience this problem while developing your macro as well. If there's not a change to the source code that's being...
Read more >All about macros with babel-plugin-macros (at ReactJS Utah)
Babel plugins are useful for syntax, but also for custom transformations to improve developer experience in a codebase.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@styfle yes, I can confirm that the error is absent in
canary
💯Please try the latest release v12.0.8-canary.19 using
yarn add next@canary
ornpm install next@canary
to confirm that the issue is fixed, thanks!