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

Cannot set $flag-icons-included-countries variable with @use #1335

Open
kristofdho opened this issue Feb 25, 2025 · 2 comments
Open

Cannot set $flag-icons-included-countries variable with @use #1335

kristofdho opened this issue Feb 25, 2025 · 2 comments

Comments

@kristofdho
Copy link

Proper way to set the $flag-icons-included-countries variable with the @use sass directive instead of the @import directive is like this:

@use 'flag-icons/sass/flag-icons' with (
  $flag-icons-included-countries: 'us' 'de' 'fr' 'es'
);

However this fails with following error:

./src/app/example.component.scss?ngResource - Error: Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
This variable was not declared with !default in the @used module.
  ╷
5 │   $flag-icons-included-countries: 'us' 'de' 'fr' 'es'
  │   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  ╵
  src\app\example.component.scss 5:3  root stylesheet


error Command failed with exit code 1.

So for now we're stuck using it like this:

$flag-icons-included-countries: 'us' 'de' 'fr' 'es';
@import 'flag-icons/sass/flag-icons';

which achieves the desired result, but forces us to keep using @import.

In order to resolve the issue, $flag-icons-included-countries should be properly defined as a variable, just like e.g. $flag-icons-use-square.

@lipis
Copy link
Owner

lipis commented Feb 26, 2025

We're working on it and there is an issue with @use and @imports (#1324)

@kristofdho
Copy link
Author

Hi, thank you for the swift reply.
I found these PRs as well, but they do not add a proper variable declaration for $flag-icons-included-countries yet, which is why I created this issue.

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