error to generate build: [vite:load-fallback] Could not load

Viewed 305

The problem seems to be that I set baseUrl in TypeScript and paths(alias).

config of typeScript

"baseUrl": ".",
    "paths": {
      "screens/*": ["./src/screens/*"],
      "components/*": ["./src/components/*"]
    }

for it to work i also had to configure Vite in: vite.config.ts

export default defineConfig({
  plugins: [react()],
  resolve:{
    alias:{
      screens: path.resolve(__dirname, './src/screens'),
      components: 'src/components',
    }
  }
})

when using

npm run build

generated the following error:

[vite:load-fallback] Could not load src/components/tables/MainTable (imported by src/screens/Home.tsx): ENOENT: no such file or directory, open 'C:\Users\USER\Documents\proyect-test\src\components\tables\MainTable'
error during build:
Error: Could not load src/components/tables/MainTable (imported by src/screens/Home.tsx): ENOENT: no such file or directory, open 'C:\Users\USER\Documents\proyect-test\src\components\tables\MainTable'

This project is small and used as an example

1 Answers
Related