最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Nuxt 3 - resolver.resolveModule is not a function - Stack Overflow

programmeradmin4浏览0评论

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:

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 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./nuxt-munity/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

Share Improve this question edited Nov 13, 2021 at 10:51 kissu 46.8k16 gold badges90 silver badges189 bronze badges asked Nov 13, 2021 at 9:28 Freestyle09Freestyle09 5,50810 gold badges58 silver badges92 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 15

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";',
                },
            },
        },
    }
发布评论

评论列表(0)

  1. 暂无评论