aleclarson / vite-tsconfig-paths

Support for TypeScript's path mapping in Vite
MIT License
1.28k stars 45 forks source link

After upgrading to the latest version, the file cannot be parsed. #20

Closed lzm0x219 closed 3 years ago

lzm0x219 commented 3 years ago

image

aleclarson commented 3 years ago

Follow the instructions in Troubleshooting, and paste the logs here.

You can also write a failing test here and open a PR with it (no fix necessary).

git clone https://github.com/aleclarson/vite-tsconfig-paths
cd vite-tsconfig-paths
pnpm install
yarn test --watch -i
cef62 commented 3 years ago

Hey, @aleclarson thank you for the plugin! It's awesome. Since upgrading to the latest I'm having the same issue as @vvni

I get the error with version 3.3.7, it works fine with 3.3.2.

DEBUG=vite-tsconfig-paths yarn workspace preview dev
  vite-tsconfig-paths crawling "/Volumes/Dev/Repos/ww-ui-components/apps/preview" +0ms
  vite-tsconfig-paths options: {
  projects: [ '/Volumes/Dev/Repos/ww-ui-components/apps/preview/tsconfig.json' ],
  extensions: [ '.ts', '.tsx', '.js', '.jsx', '.mjs' ]
} +12ms
  vite-tsconfig-paths config loaded: {
  configPath: '/Volumes/Dev/Repos/ww-ui-components/apps/preview/tsconfig.json',
  include: [ '../../packages/ui-components/src', './src' ],
  exclude: undefined,
  allowJs: undefined,
  baseUrl: '/Volumes/Dev/Repos/ww-ui-components/apps/preview',
  paths: {
    '@/helpers/*': [ 'src/helpers/*' ],
    '@/previews/*': [ 'src/previews/*' ],
    '@/theme': [ './src/theme/index.ts' ],
    '@/components': [ '../../packages/ui-components/src/index.ts' ],
    '@/components/VirtualList': [ '../../packages/ui-components/src/VirtualList/index.ts' ]
  }
} +4ms
error when starting dev server:
Error: The following dependencies are imported but could not be resolved:

  @/theme (imported by /Volumes/Dev/Repos/ww-ui-components/apps/preview/src/core/Provider/Provider.tsx)
  @/helpers/useQueryState (imported by /Volumes/Dev/Repos/ww-ui-components/apps/preview/src/core/App/hooks/usePreviewItems.ts)
  @/previews/VirtualList (imported by /Volumes/Dev/Repos/ww-ui-components/apps/preview/src/core/App/components/AppContent/ActivePreview.tsx)

Are they installed?
    at optimizeDeps (/Volumes/Dev/Repos/ww-ui-components/.yarn/cache/vite-npm-2.2.1-f13c23e464-0c297aabe4.zip/node_modules/vite/dist/node/chunks/dep-5c642f9e.js:65569:15)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async runOptimize (/Volumes/Dev/Repos/ww-ui-components/.yarn/cache/vite-npm-2.2.1-f13c23e464-0c297aabe4.zip/node_modules/vite/dist/node/chunks/dep-5c642f9e.js:69326:48)
    at async Server.httpServer.listen (/Volumes/Dev/Repos/ww-ui-components/.yarn/cache/vite-npm-2.2.1-f13c23e464-0c297aabe4.zip/node_modules/vite/dist/node/chunks/dep-5c642f9e.js:69340:17)

I can try to create a failing test but I'm not sure I'll be able to do it quickly. Could you provide any hint looking at the logs?

aleclarson commented 3 years ago

@cef62 Thanks for the logs. That helped a ton!

v3.3.8 has all the include bugs ironed out, I think.

cef62 commented 3 years ago

Thank you @aleclarson! With v3.3.8 everything is working as expected!