linaria
linaria copied to clipboard
Regression since v2 (from 1.4)
Environment
- Linaria version: v2
- Bundler (+ version): webpack 5 + babel 7.15
- Node.js version: 14
- OS: Ubuntu
Description
What 1st appears as a babel issue might be a linaria issue. Rolling back linaria to 1.4 from v2 while upgrading babel to 7.15 fixes our issue.
Also, as notice in the babel ticket, the babel.config.js is called when using linaria in webpack babel-loader context, (v1.4 and v2), dont know if it is a clue but I found it weird.
See this ticket https://github.com/babel/babel/issues/13722 for more details but in a nutshell a build with webpack & babel-loader is broken when having decorator if babel is v7.15 & linaria v2
Without a wide babel config, it crashes not on decorator but on TypeScript syntax, as if nothing was transformed, which made me think that linaria does not uses input from previous loader, but run it's own babel process.
Reproducible Demo
https://github.com/JSteunou/babel-linaria-decorator-issue
I finally had time to make a repo to reproduce this issue https://github.com/JSteunou/babel-linaria-decorator-issue
You can play with it and see that rolling back linaria to 1.4 solve it
Hi @Anber, if you or another team member has some time, here is the analyse from babel's member nicolo-ribaudo https://github.com/babel/babel/issues/13722#issuecomment-912940846
It's to complex for me to open a PR on this but maybe I could help if someone guide me a little if you do not have the time to fix this and want to focus on v3
Hi @JSteunou
Thank you for the investigation! I'll try to figure out what can be done here.
Hi again,
any news on this one? I'm seeing the label needs: complete repro
which this issue already has + analyses from babel. What could I add to help?
Hi @JSteunou
In theory, you can use babelOptions
and pass missed plugins to Linaria's Babel config. However, even in that case, it doesn't work probably because of conflicts in plugins order. Would be cool if you can find out where exactly that conflict is.
it rather seems at some point Linaria does not use the babel configuration