Friday, May 17, 2024
 Popular · Latest · Hot · Upcoming
160
rated 0 times [  163] [ 3]  / answers: 1 / hits: 5506  / 3 Years ago, sat, november 13, 2021, 12:00:00

I want to configure style-resources and use some variables globally in fresh Nuxt 3 project but when I am passing some options to nuxt.config file I am getting this error:


Cannot start nuxt: resolver.resolveModule is not a function


My dependencies:


  "devDependencies": {
"nuxt3": "latest",
"prettier": "^2.4.1"
},
"dependencies": {
"@nuxtjs/style-resources": "^1.2.1",
"sass": "^1.43.4"
}

nuxt.config.js


export default defineNuxtConfig({
css: ['~/assets/main.scss'],
buildModules: ['@nuxtjs/style-resources'],
styleResources: {
scss: ['./assets/variables.scss'],
},
});

I am using this library:
https://github.com/nuxt-community/style-resources-module


I know Nuxt 3 is still in Beta release but maybe someone faced this issue already or knows different way to apply global resources


More From » nuxt.js

 Answers
1

I don't think that module is supported in Nuxt3. Adding this to nuxt.config worked for me:


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

[#684] Sunday, October 31, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
michaelashelbieh

Total Points: 303
Total Questions: 139
Total Answers: 97

Location: Suriname
Member since Sun, Oct 17, 2021
3 Years ago
michaelashelbieh questions
;