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

failed import from '#build/*' #2594

Open
RomanRadaykinFrontend opened this issue Mar 25, 2024 · 0 comments
Open

failed import from '#build/*' #2594

RomanRadaykinFrontend opened this issue Mar 25, 2024 · 0 comments

Comments

@RomanRadaykinFrontend
Copy link

RomanRadaykinFrontend commented Mar 25, 2024

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: npm@10.2.4
  • 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?
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

1 participant