linaria icon indicating copy to clipboard operation
linaria copied to clipboard

Regression since v2 (from 1.4)

Open JSteunou opened this issue 3 years ago • 6 comments

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

JSteunou avatar Sep 02 '21 09:09 JSteunou

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

JSteunou avatar Sep 03 '21 08:09 JSteunou

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

JSteunou avatar Sep 06 '21 07:09 JSteunou

Hi @JSteunou

Thank you for the investigation! I'll try to figure out what can be done here.

Anber avatar Sep 12 '21 13:09 Anber

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?

JSteunou avatar Oct 12 '21 08:10 JSteunou

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.

Anber avatar Oct 31 '21 17:10 Anber

it rather seems at some point Linaria does not use the babel configuration

JSteunou avatar Nov 04 '21 14:11 JSteunou