Configure SASS Load Path in Nuxt 3

Viewed 132

I have my SCSS partials in my Nuxt 3 project's assets/css directory (e.g. assets/css/_cards.scss). I can import them in my components using the full path (@use '~/assets/css/cards';), but I'm having trouble getting the load path working so that I can import like @use 'cards';

From what I've seen, the Nuxt config should look like this to enable that, but this and similar variations are not working for me.

export default defineNuxtConfig({
    vite: {
        css: {
            preprocessorOptions: {
                scss: {
                    loadPaths: ['@/assets/css'],
                },
            },
        },
    },
});
0 Answers
Related