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

Passing an array as sass / scss importer does not work properly. #3526

Closed
6 tasks done
j000 opened this issue May 24, 2021 · 1 comment · Fixed by #3529
Closed
6 tasks done

Passing an array as sass / scss importer does not work properly. #3526

j000 opened this issue May 24, 2021 · 1 comment · Fixed by #3529
Labels
feat: css p3-minor-bug An edge case that only affects very specific usage (priority)

Comments

@j000
Copy link
Contributor

j000 commented May 24, 2021

In config, passing importer as an array does nothing:
css: { preprocessorOptions: { sass: { importer: [SomeFunction, OtherFunction] } } }
Passing single function works as intended.

#3395 introduced this part of code:
https://github.com/axe-me/vite/blob/465ee5a453579517fa7887f1c9c2b66614270bdc/packages/vite/src/node/plugins/css.ts#L932-L936

Array.concat does not modify source array but returns a modified one. Here it's not assigned to anything.

BTW Thank you, for a nice and useful piece of software :)

System Info

Output of npx envinfo --system --npmPackages vite,@vitejs/plugin-vue --binaries --browsers:

  System:
    OS: Linux 5.12 Gentoo/Linux
    CPU: (8) x64 AMD Ryzen 5 2400G with Radeon Vega Graphics
    Memory: 260.44 MB / 7.56 GB
    Container: Yes
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.2.0 - /usr/bin/node
    Yarn: 1.22.10 - /usr/bin/yarn
    npm: 7.13.0 - /usr/bin/npm
  Browsers:
    Firefox: 88.0.1
  npmPackages:
    @vitejs/plugin-vue: ^1 => 1.2.2 
    vite: ^2 => 2.3.3 

Used package manager: yarn


Before submitting the issue, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Provide a description in this issue that describes the bug.
  • Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/vue-next instead.
  • Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
@patak-dev
Copy link
Member

@j000 would you like to send a PR to fix this?

@patak-dev patak-dev added p3-minor-bug An edge case that only affects very specific usage (priority) feat: css labels May 24, 2021
j000 added a commit to j000/vite that referenced this issue May 24, 2021
This change allows passing an array with multiple custom importers.

JavaScript does not mind passing `undefined` to concat, so additional checks are not needed. In that case shallow copy is created, but it does not matter here.

Closes vitejs#3526.
j000 added a commit to j000/vite that referenced this issue May 24, 2021
This change allows passing an array with multiple custom importers.

JavaScript does not mind passing `undefined` to concat, so additional checks are not needed. In that case shallow copy is created, but it does not matter here.

Closes vitejs#3526.
@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feat: css p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants