question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't transpile a babel macro project

See original GitHub issue

Run 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

CleanShot 2022-01-04 at 23 05 34@2x

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:closed
  • Created 2 years ago
  • Comments:14 (10 by maintainers)

github_iconTop GitHub Comments

5reactions
benbendercommented, Jan 6, 2022

@styfle yes, I can confirm that the error is absent in canary 💯

1reaction
styflecommented, Jan 6, 2022

Please try the latest release v12.0.8-canary.19 using yarn add next@canary or npm install next@canary to confirm that the issue is fixed, thanks!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found