Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

fix: handle css loader import option from #21

Merged
merged 1 commit into from
Feb 9, 2022

Conversation

RyanClementsHax
Copy link
Owner

fixes #19

Apparently the import option for css-loader gets passed arguments as specified on the v3 docs instead of v5 (which is the same as v4).

When I tried to use the v5 option structure, the webpack config validation errored with a link that import needed to be a boolean or a function, then linked me to this which clearly specifies that it should be the v5 option structure, not the v3 option structure.

What I had before is exactly how nextjs handles this, so I'm wondering if I'm missing a webpack config or something.

I'm at loss for how to get the seemingly proper solution, namely to make sure that the v5 option structure is used instead, or even to make it so this config can mirror what nextjs is doing.

This makes the basic fix to handle the case that it is passed an object or a string.

This also includes setting importLoaders to what nextjs sets its loaders to (1 for regular css, and 3 for sass) so the preprocessors can be called for imports. (Example)

@RyanClementsHax RyanClementsHax merged commit 17def18 into main Feb 9, 2022
@RyanClementsHax RyanClementsHax deleted the handle-css-imports branch February 9, 2022 22:42
@github-actions
Copy link

github-actions bot commented Feb 9, 2022

🎉 This PR is included in version 1.4.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CSS @import throws error
1 participant