-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
@emotion/babel-plugin with React 17 and Typescript 4 and webpack does not apply labels #2315
Comments
Modify your webpack config, problem will be resovle, but you will encounter other problem in your demo project. // configs/webpack/common.js
- use: ["babel-loader", "awesome-typescript-loader"]
+ use: ["awesome-typescript-loader", "babel-loader"] btw: |
@iChenLei could you send me your configuration and list the versions of each tool you're using to get the labels to work? thanks! |
HI , @nicmosc Nothing special. Just download your codesandbox demo as a zip file , and modify common webpack config.- use: ["babel-loader", "awesome-typescript-loader"]
+ use: ["awesome-typescript-loader", "babel-loader"] I strongly recommed you use the latest version of
|
@iChenLei so it seems to be an issue with |
Sorry I don't know that you care about |
Ok found the issue: in the For anyone bumping into this and having issues with getting the compilation going with module.exports = {
presets: [
['@babel/preset-env', { useBuiltIns: 'usage', corejs: { version: 3 } }],
['@babel/preset-react', { runtime: 'automatic' }],
],
plugins: [
['@emotion/babel-plugin', {
sourceMap: true,
autoLabel: 'always',
labelFormat: '[filename]__[local]',
}],
],
} The ✌️ |
Current behavior:
Using the latest version of
@emotion/css
,@emotion/babel-plugin
andreact
the labels to classnames using thecss
function do not apply at all (not even the default ones which should be applied in development)..babelrc
To reproduce:
Used a custom sandbox to be able to edit the
.babelrc
file to show the plugin not workinghttps://codesandbox.io/s/peaceful-volhard-vhdkp?file=/src/index.tsx
Check the
index.tsx
to see the usage, and the.babelrc
config to see the settings configured as per the documentation.Any setting in the
.babelrc
, or even when using inline options in the webpack config, nothing changes. Labels are always just the hashes, not even the default[local]
is applied.Expected behavior:
Components with
className
set to the@emotion/css
css
value should have labelsNote that it seems to work with Parcel (without TS) https://codesandbox.io/s/react-optional-chaining-demo-forked-ttuv5?file=/package.json
Environment information:
react
version: 17.0.2@emotion/css
version: 11.1.3@emotion/babel-plugin
version: 11.2.0webpack
version: 4.41.2The text was updated successfully, but these errors were encountered: