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

tsconfig paths do not work in vite.config.ts #10063

Closed
7 tasks done
Enteleform opened this issue Sep 10, 2022 · 2 comments
Closed
7 tasks done

tsconfig paths do not work in vite.config.ts #10063

Enteleform opened this issue Sep 10, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@Enteleform
Copy link

Enteleform commented Sep 10, 2022

Describe the bug

paths added to tsconfig.node.json are not able to be imported when running vite.

Expected:
Aliased paths will be imported successfully.

Actual:
ERR_MODULE_NOT_FOUND is thrown.

Reproduction

enteleform-codesandbox/0016--Vite--TypeScript-Paths@c970d37

System Info

System:
    OS: Windows 10 10.0.19044
    CPU: (8) x64 Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz    
    Memory: 34.67 GB / 63.96 GB
  Binaries:
    Node: 18.8.0 - C:\_\Dev\NodeJS\18\node.EXE
    Yarn: 1.22.19 - C:\_\Dev\NodeJS\18\yarn.CMD
    npm: 8.18.0 - C:\_\Dev\NodeJS\18\npm.CMD
  Browsers:
    Chrome: 105.0.5195.102
    Edge: Spartan (44.19041.1266.0), Chromium (105.0.1343.27)
    Internet Explorer: 11.0.19041.1566

Used Package Manager

npm

Logs

Click to expand!
> vite

failed to load config from D:\0016--Vite--TypeScript-Paths\vite.config.ts
error when starting dev server:
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'VitePlugins' imported from D:\0016--Vite--TypeScript-Paths\vite.config.ts.timestamp-1662805287895.mjs
    at new NodeError (node:internal/errors:393:5)
    at packageResolve (node:internal/modules/esm/resolve:810:9)
    at moduleResolve (node:internal/modules/esm/resolve:859:20)
    at defaultResolve (node:internal/modules/esm/resolve:1074:11)
    at nextResolve (node:internal/modules/esm/loader:164:28)
    at ESMLoader.resolve (node:internal/modules/esm/loader:839:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:426:18)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:40)
    at link (node:internal/modules/esm/module_job:75:36)

Validations

@sapphi-red
Copy link
Member

sapphi-red commented Sep 13, 2022

I don't think this is a bug.
I agree with this explaination here from ts-node's README. (Vite doesn't use ts-node though.)

related: #6828

@sapphi-red sapphi-red added enhancement New feature or request and removed pending triage labels Sep 13, 2022
@bluwy
Copy link
Member

bluwy commented Sep 13, 2022

I think this should be closed in favour of #6828. It would be confusing if the tsconfig paths work in vite.config.js but not in the Vite project. We should have it both working for this feature.

@bluwy bluwy closed this as not planned Won't fix, can't repro, duplicate, stale Sep 13, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Sep 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants