js-lingui icon indicating copy to clipboard operation
js-lingui copied to clipboard

"cli extract" fails when I do not use macro and have no babel macro package installed

Open meglio opened this issue 2 years ago • 4 comments

Describe the bug

I'm using Next.js. I do not need macros, so I decided not to install @babel/macro etc. I did it because I want Next.js to use SWC.

To Reproduce

Create a minimal Next.js project. Do not install anything related to macros. Run yarn extract.

Console logs gets lots of warnings - lingui-extract.js tries to use babel-plugin-macros.

Expected behavior

extract/compile should work without babel-plugin-macros dependency.

Additional context

  • jsLingui version 3.13.2

  • Your Babel config (e.g. .babelrc) - Next.js; no custom babelrc config.

meglio avatar Mar 10 '22 06:03 meglio

As workaround, you can add

  extractBabelOptions: {
    presets: ['next/babel'],
  },

in lingui.config.js

St0necrusher avatar Mar 28 '22 16:03 St0necrusher

Lingui heavily depends on macro's to work, and SWC doesn't have yet anything around macros. I'm sorry

semoal avatar Apr 24 '22 16:04 semoal

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jun 24 '22 03:06 stale[bot]

What's the idea behind automatically closing issues that are not rejected explicitly? If nobody can take care of it now, it does not mean the issue automagically becomes irrelevant or not actual. It is still actual.

meglio avatar Jul 02 '22 12:07 meglio

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 08 '22 22:09 stale[bot]

Has it been completed, actually?

meglio avatar Sep 20 '22 12:09 meglio

This won't get done ever. We use babel-plugin-macros for extracting the t``. Until SWC opens a way to interact with the AST code we CAN'T do nothing.

semoal avatar Sep 20 '22 13:09 semoal