Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't use with @vitejs/plugin-react #7

Closed
shlroland opened this issue Oct 20, 2021 · 7 comments
Closed

can't use with @vitejs/plugin-react #7

shlroland opened this issue Oct 20, 2021 · 7 comments

Comments

@shlroland
Copy link

#6 same issue

@itsMapleLeaf
Copy link
Owner

Can you share the error messages you're getting, if any?

@quolpr
Copy link

quolpr commented Nov 20, 2021

You can enable babel macros for react with this code:

    react({
      babel: {
        plugins: ['babel-plugin-macros']
      },
    }),

@pedrosimao
Copy link

You can enable babel macros for react with this code:

    react({
      babel: {
        plugins: ['babel-plugin-macros']
      },
    }),

This works for me, but Jest tests will fail while using emotion styled function for example:

TypeError: (0 , macro_1.default) is not a function

Any ideas on how to fix this?

@itsMapleLeaf
Copy link
Owner

itsMapleLeaf commented Mar 3, 2022

You can enable babel macros for react with this code:

    react({
      babel: {
        plugins: ['babel-plugin-macros']
      },
    }),

This works for me, but Jest tests will fail while using emotion styled function for example:

TypeError: (0 , macro_1.default) is not a function

Any ideas on how to fix this?

I would recommend switching to Vitest https://vitest.dev/

Either way, this issue is veering off topic and doesn't have sufficient information or a reproduction, so I'm closing it

@fpigeonjr
Copy link

You can enable babel macros for react with this code:

    react({
      babel: {
        plugins: ['babel-plugin-macros']
      },
    }),

Confirmed, this worked for me as well.
Wonder why this isn't documented in the README?

@itsMapleLeaf
Copy link
Owner

You can enable babel macros for react with this code:

    react({
      babel: {
        plugins: ['babel-plugin-macros']
      },
    }),

Confirmed, this worked for me as well. Wonder why this isn't documented in the README?

Because no one suggested to do so! 😅 I'll go ahead and take care of that

@fpigeonjr
Copy link

🥇thanks @itsMapleLeaf that would be helpful as it took me awhile to find this. It would be nice to have an example of how to setup for React based projects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants