Skip to content

How to use scss pkg imports? #17948

Answered by hi-ogawa
todor-a asked this question in Q&A
Aug 26, 2024 · 1 comments · 6 replies
Discussion options

You must be logged in to vote

@todor-a I made a example here https://github.com/hi-ogawa/reproductions/tree/main/vite-17948-sass-NodePackageImporter. The correct configuration looks like this

import { defineConfig } from "vite";
import { NodePackageImporter } from "sass-embedded";

export default defineConfig({
  css: {
    preprocessorOptions: {
      scss: {
        api: "modern-compiler",
        importers: [new NodePackageImporter()],
      },
    },
  },
});

I should've pointed out this earlier, but as explained in https://vitejs.dev/config/shared-options.html#css-preprocessoroptions, supported options for "legacy" and "modern" are slightly different.

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@todor-a
Comment options

@todor-a
Comment options

@todor-a
Comment options

@hi-ogawa
Comment options

Answer selected by todor-a
@todor-a
Comment options

@aholland
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants