Replies: 1 comment 4 replies
-
Here's a (somewhat noisy) test repo with what i'm talking about. If you compare the main branch with the |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I was toying with using the Native CSS support -- quite excited to leverage this (#14893). I have a combination of statements in the code previously supported by the
css-loader
andmini-css-extract-plugin
.Some are immediate loads when the parent JS module is loaded
and some are dynamic imports (on demand):
Once I've enabled the
experiments.css
support — I'm realizing that this, combined withoutput.chunkFormat: 'module';
andexperiments.outputModule: true
... these files are no longer fetched!I end up with errors like:
I'm realizing I may need to switch to import assertions (
with { type: "css" }
) to be in support of "web standards" for the modules.I can do this natively, of course, but I need the final urls, chunks, and generated filenames for the CSS files to do this in production.
I see on the #14893 ticket that import assertion (Task B, probably with a change to
with
) is still unimplemented. The native support is great since with thecss-loader
andmini-css
you end up with the extra JS files for CSS files that aren't actually necessary.Does anyone know when that will land? Any alternatives to avoid generating a JS file for these "modules" that aren't actually JS modules at this point? Even if I had an import statement I could use in the JS file that would be updated and include the final URL, I could then
fetch()
the CSS file. I triednew URL()
but it didn't work and -- yup, that task D is still on the not implemented list 😅Maybe I'm just too early? Maybe there's a feature (via insert?) that I'm missing in
mini-css-extract
that will allow me to parse these CSS links and get their URL? I don't even need to use the CSS members in the JS -- this is just on-demand loading of the CSS due to routing and file size limitations. Today it works fine but the extra requests is a bummer.So:
css-loader
andmini-css
(for now)experiments.css
+chunkFormat: module
? — incidentally, I've seen thebasic-esm-target-web
test case, but I haven't gotten that working for me, personally to dateI'm hoping someone in the community or even @alexander-akait may be able to point me in the right direction.
Beta Was this translation helpful? Give feedback.
All reactions