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

Rollup bundle generates invalid linaria imports instead of css since @linaria/rollup@3.0.0-beta.6 #778

Closed
nstepien opened this issue Jun 10, 2021 · 4 comments
Labels
bug report 🦗 Issue is probably a bug, but it needs to be checked bundler: rollup 🗞️ Issue is related to rollup bundler bundler: webpack 📦 Issue is related to webpack bundler needs: complete repro 🖥️ Issue need to have complete repro provided

Comments

@nstepien
Copy link
Contributor

Environment

  • Linaria version: 3.0.0-beta.6
  • Bundler (+ version): rollup@2.51.1
  • Node.js version: v16.3.0
  • OS: win10

Description

There is a regression with @linaria/rollup@3.0.0-beta.6, the issue is not present with @linaria/rollup@3.0.0-beta.5.
The bundle does not include the css anymore, linaria imports are left as is instead.

For example, with @linaria/rollup@3.0.0-beta.5:
image

After upgrading to @linaria/rollup@3.0.0-beta.6:
image

Reproducible Demo

  1. clone https://github.com/adazzle/react-data-grid
  2. npm i
  3. npm run build
  4. inspect the resulting bundle lib/bundle.js
@nstepien nstepien added bug report 🦗 Issue is probably a bug, but it needs to be checked needs: complete repro 🖥️ Issue need to have complete repro provided needs: triage 🏷 Issue needs to be checked and prioritized labels Jun 10, 2021
@github-actions github-actions bot added bundler: rollup 🗞️ Issue is related to rollup bundler bundler: webpack 📦 Issue is related to webpack bundler and removed needs: triage 🏷 Issue needs to be checked and prioritized labels Jun 10, 2021
@Anber
Copy link
Collaborator

Anber commented Jun 10, 2021

Hi @nstepien!

I'm not familiar with rollup, but something went wrong after that PR. I'll try to figure out what to do with it in the next couple of days.

Thank you!

@wmzy
Copy link
Contributor

wmzy commented Jun 11, 2021

 external: (id) => !id.startsWith('.') || !isAbsolute(id)

to

external: (id) => !id.startsWith('@linaria:') || !!id.startsWith('.') || !isAbsolute(id)

will work?

@nstepien
Copy link
Contributor Author

@wmzy
This worked

external: (id) => !id.startsWith('.') && !isAbsolute(id) && !id.startsWith('@linaria:'),

Nice catch, thanks.
Not sure if anything should be fixed in @linaria/rollup then.

@wmzy
Copy link
Contributor

wmzy commented Jun 11, 2021

@nstepien I don't think this is a bug.
Other rollup plugin may also use a virtual file name.

Maybe add a file name config to make It explicit is better:

plugins:[
  linaria({
     mapFilename: (id) => '@linaria:' + id
   })
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report 🦗 Issue is probably a bug, but it needs to be checked bundler: rollup 🗞️ Issue is related to rollup bundler bundler: webpack 📦 Issue is related to webpack bundler needs: complete repro 🖥️ Issue need to have complete repro provided
Projects
None yet
Development

No branches or pull requests

3 participants