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

Astro 1.6.3 broke scss imports #5441

Closed
1 task
Razunter opened this issue Nov 19, 2022 · 4 comments · Fixed by #5477
Closed
1 task

Astro 1.6.3 broke scss imports #5441

Razunter opened this issue Nov 19, 2022 · 4 comments · Fixed by #5477
Assignees
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority)

Comments

@Razunter
Copy link

Razunter commented Nov 19, 2022

What version of astro are you using?

1.6.10

Are you using an SSR adapter? If so, which one?

none

What package manager are you using?

pnpm

What operating system are you using?

windows

Describe the Bug

In Astro 1.6.2 I can use SCSS imports like this in .astro files:

<style lang="scss">
  @import "bootstrap/scss/functions";
  @import "bootstrap/scss/variables";
</style>

In Astro 1.6.3-1.6.10 I'm getting

Error: Undefined mixin.
    441 │ @include _assert-ascending($grid-breakpoints, "$grid-breakpoints");
      node_modules\.pnpm\bootstrap@5.2.2_@popperjs+core@2.11.6\node_modules\bootstrap\scss\_variables.scss 441:1

Also, the same thing from another angle.
In astro 1.6.2 config, this works fine:

    css: {
      preprocessorOptions: {
        scss: {
          additionalData: '@import "@css/variables.scss";',
        },
      },
    },

Astro 1.6.3 throws Error: This file is already being loaded.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-29kwpe-br2j1m?file=src/pages/index.astro

Participation

  • I am willing to submit a pull request for this issue.
@matthewp
Copy link
Contributor

Most likely because of this, 1cc0670

@bluwy assigning to you, I scanned the code and didn't see anything obvious however.

@matthewp matthewp added - P5: urgent Fix build-breaking bugs affecting most users, should be released ASAP (priority) - P4: important Violate documented behavior or significantly impacts performance (priority) and removed - P5: urgent Fix build-breaking bugs affecting most users, should be released ASAP (priority) labels Nov 21, 2022
@JerryWu1234
Copy link
Contributor

JerryWu1234 commented Nov 23, 2022

https://stackoverflow.com/questions/29591196/sass-compiler-throws-undefined-mixin-error-when-mixins-are-kept-in-seperate-fo

I think this wasn't a bug.

you can change <style lang="scss"> @import "bootstrap/scss/functions"; @import "bootstrap/scss/variables"; </style> to
<style lang="scss"> @use "bootstrap/scss/functions" as *; @use "bootstrap/scss/variables" as *; </style>
and then to try it

@bluwy
Copy link
Member

bluwy commented Nov 24, 2022

1.6.2 and below also seems to cause the error, which is strange because I remember seeing it work too but now it doesn't.

Anyways I traced this back to Vite's custom importer which is using an older importer API syntax (node-sass) but it should still work.

Still playing with things at the moment but I should be able to find a backwards-compatible fix.

@bluwy
Copy link
Member

bluwy commented Nov 25, 2022

Should be fixed at vitejs/vite#11079. I'd also need to make a small change in Astro to be lenient when inling styles as some SCSS files are partials and can't be inlined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants