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

When a dynamically imported module includes CSS, code splitting results in an invalid CSS import #1125

Closed
nihalgonsalves opened this issue Apr 7, 2021 · 1 comment

Comments

@nihalgonsalves
Copy link

import('./module-name.css') appears in the output, in place of the actual .js file.

There's a reproduction here: https://codesandbox.io/s/interesting-mayer-uvouc?file=/out/parent.js, but I'm inlining the code here for clarity:

esbuild options

esbuild src/parent.js --bundle --outdir=./out --splitting --format=esm --platform=browser

Input

src/parent.js

import('./child')

src/child.js

import './foo.css'

src/foo.css

body {
  color: black;
}

Output

out/parent.js

// src/parent.js
import("./child.css");

^ child.js should be imported here

out/child.js

Empty (this is ok)

out/child.css

/* src/foo.css */
body {
  color: black;
}
@evanw evanw closed this as completed in 938f719 Apr 9, 2021
@evanw
Copy link
Owner

evanw commented Apr 9, 2021

Thanks for the report and the clear repro. A fix for this will be in the next release.

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