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

craco babel settings not working @emotion/react #61

Closed
leesuhyung opened this issue Jun 30, 2022 · 3 comments
Closed

craco babel settings not working @emotion/react #61

leesuhyung opened this issue Jun 30, 2022 · 3 comments

Comments

@leesuhyung
Copy link

// emotion css prop is not working
module.exports = {
  babel: {
    presets: [
      [
        '@babel/preset-react',
        {'runtime': 'automatic', 'importSource': '@emotion/react'}
      ]
    ],
    plugins: ['@emotion/babel-plugin']
  },
  plugins: [
    {
      plugin: CracoEsbuildPlugin,
    },
    ...
  ],
}

// it works
module.exports = {
  babel: {
    presets: [
      [
        '@babel/preset-react',
        {'runtime': 'automatic', 'importSource': '@emotion/react'}
      ]
    ],
    plugins: ['@emotion/babel-plugin']
  },
  ... // use the default babel settings of react-script instead of esbuild
}

When I use craco esbuild, cannot use css props in emotion.
Is the craco esbuild plugin clearing babel settings?

@pradel
Copy link
Owner

pradel commented Jun 30, 2022

Yes, esbuild is replacing babel totally.

@pradel pradel closed this as completed Jun 30, 2022
@leesuhyung
Copy link
Author

@pradel Sorry to bother you, is there any way to use babel preset while using esbuild?

@pradel
Copy link
Owner

pradel commented Jun 30, 2022

Maybe there you can see how but I never did this privatenumber/esbuild-loader#99

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

2 participants