content icon indicating copy to clipboard operation
content copied to clipboard

failed import from '#build/*'

Open RomanRadaykinFrontend opened this issue 1 year ago • 0 comments

Environment

  • Operating System: Darwin
  • Node Version: v20.11.0
  • Nuxt Version: 3.11.1
  • CLI Version: 3.11.1
  • Nitro Version: 2.9.4
  • Package Manager: [email protected]
  • Builder: -
  • User Config: sharedConfig
  • Runtime Modules: -
  • Build Modules: -

Reproduction

I don't think I need a replay, it just seems like I'm missing something.

Describe the bug

Снимок экрана 2024-03-25 в 13 26 38
TS2792: Cannot find module '#build/services/generated/auth'. Did you mean to set the 'moduleResolution' option to 'node', or to add aliases to the 'paths' option?

At the same time, the imports are all correct, I can get into each folder along this path. When importing '../../../*' everything works ok. How do I make an auto-import to a custom folder? Or at least remove the error above.

Additional context

tsconfig { "extends": "./.nuxt/tsconfig.json", "moduleResolution":"node", }

nuxt.config.ts export const sharedConfig = { devtools: { enabled: true }, rootDir: __dirname, modules: ['@element-plus/nuxt', '@pinia/nuxt'], elementPlus: { importStyle: 'scss', themes: ['dark'], }, plugins: ['plugins/ofetch', 'plugins/store'], pinia: { storesDirs: ['./sharedStore/*'], }, // IT IS NOT WORK imports: { dirs: ['services'], }, vite: { css: { preprocessorOptions: { scss: { additionalData: @use "../../assets/styles/typography.scss" as *; @use "../../assets/styles/index.scss" as *; @use "../../assets/styles/themes.scss" as *; @use "../../assets/styles/elements-rewrite.scss" as *; @use "../../assets/styles/elements-colors.scss" as *; @use "../../assets/styles/fonts.scss" as *;, }, }, }, }, }

Logs

ERROR  Pre-transform error: Failed to resolve import "#build/services/generated/auth" from "../../sharedStore/auth.ts". Does the file exist?

RomanRadaykinFrontend avatar Mar 25 '24 10:03 RomanRadaykinFrontend