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
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";',
},
},
},
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With