Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nuxt Layers Cannot find module 'vuetify/package.json' #277

Open
aleksejssaburovs92 opened this issue Sep 13, 2024 · 4 comments
Open

Nuxt Layers Cannot find module 'vuetify/package.json' #277

aleksejssaburovs92 opened this issue Sep 13, 2024 · 4 comments

Comments

@aleksejssaburovs92
Copy link

aleksejssaburovs92 commented Sep 13, 2024

Hello! Tried to use vuetify-nuxt-module in layer and include it in parent project, got error while running yarn dev:

Screenshot 2024-09-13 at 15 17 14

Function that causes error
node_modules/.c12/gitlab_ecofinance_frontend_3egwiQ38Rj/node_modules/@vuetify/loader-shared/dist/index.mjs

function resolveVuetifyBase() {
  return path.dirname(require.resolve("vuetify/package.json", { paths: [process.cwd()] }));
}

Parent nuxt config:

// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  compatibilityDate: '2024-04-03',
  devtools: { enabled: true },
  extends: [
    ['gitlab:ecofinance-frontend/nuxt-base-layer', { install: true, auth: process.env.GITLAB_TOKEN } ],
  ],
})

Layer nuxt config:

import { fileURLToPath } from 'url'
import { dirname, join } from 'path'

const currentDir = dirname(fileURLToPath(import.meta.url))
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  compatibilityDate: '2024-04-03',
  devtools: { enabled: true },
  modules: [
    // '@nuxtjs/storybook',
    '@nuxtjs/tailwindcss',
    'vuetify-nuxt-module',
    '@nuxtjs/google-fonts',
    '@nuxtjs/i18n'
  ],
  googleFonts: {
    download: false,
    useStylesheet: true,
    preload: true,
    display: 'swap',
    families: {
      Inter: [400, 700],
    },
  },
  vuetify: {
    moduleOptions: {
      styles: {
        configFile: join(currentDir, './assets/styles/vuetify.scss')
      }
    },
    vuetifyOptions: join(currentDir, './vuetify.config.ts')
  },
  features: {
    inlineStyles: false,
  },
  nitro: {
    compressPublicAssets: true
  },
  sourcemap: false
})

Adding same vuetify-nuxt-module dependency in parent project fixes problem, but it rewrites all layer config.

@userquin
Copy link
Member

Try adding vuetify as dependency

@aleksejssaburovs92
Copy link
Author

Adding vuetify in parent project does fixes error, but now it ignores all configuration, like SASS variables

$color-pack: false,
$utilities: false,

@userquin
Copy link
Member

what's your project structure? I don't see any layer in the configuration nor custom modules

@eduardotang
Copy link

i encountered similar problem, where the base layer locates in the same level of the project extending this layer (instead of layer folder inside the project)

so in the project package.json , does it have to include vuetify-nuxt-module as dependency (base-layer already has included)

nuxtprojects/base-layer/nuxt.config.ts

export default defineNuxtConfig({
     modules: ['vuetify-nuxt-module']
})

nuxtprojects/project/nuxt.config.ts

export default defineNuxtConfig({
     extends: ['../base-layer']
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants