Comments (11)
But technically it does work if
resolve.alias
is added right?
Yes, but resolve.alias
has different resolve behaviour compared to tsconfig paths. Tsconfig paths is more lax and could map to more paths than intended, but will still cover the resolve.alias
behaviour. If we support tsconfig paths in the config, we're supporting more than what resolve.alias
covers.
i feel like support for tsconfig paths in vite.config.ts is a different issue that currently doesn't have an easy workaround? (cmiiw)
I think you can still use relative imports?
What is the consideration for the vite team to add/not add this feature?
There's still mixed opinions about this. My opinion is https://x.com/robpalmer2/status/1770612164396515667 and the result in #6828 (comment). Others think that supporting tsconfig alias would be convenient and rustifying the resolver would solve the performance issue, and that vite-tsconfig-paths
had millions of downloads per month (people want it).
from vite.
Start a new pull request in StackBlitz Codeflow.
from vite.
Currently, TS source code doesn't resolve aliases from compilerOptions.paths
too. If we do in the config, it'd need to align with the source code. But the discussions about that are at #6828, and at the moment we don't plan to support it. (However, there's still debate within the team if this is something we actually want)
from vite.
If we do in the config, it'd need to align with the source code
What does this mean again?
from vite.
If tsconfig alias would work in a config file, it should also work in your source code files for consistency.
from vite.
If tsconfig alias would work in a config file, it should also work in your source code files for consistency.
But technically it does work if resolve.alias
is added right?
i feel like support for tsconfig paths in vite.config.ts is a different issue that currently doesn't have an easy workaround? (cmiiw)
from vite.
However, there's still debate within the team if this is something we actually want
What is the consideration for the vite team to add/not add this feature?
from vite.
i dont know if this work, but what about execute the vite.config.{ts,js}
with esbuild-register
or swc-register
or maybe ts-node
?
from vite.
i dont know if this work, but what about execute the
vite.config.{ts,js}
withesbuild-register
orswc-register
or maybets-node
?
The vite config is usually used by vite's server, e.g. executing vite
(dev server) or vite build
, so it's probably not viable to use ts-node since it's we're not trying to run vite.config.ts
in isolation
Unless you mean transpiling vite.config.ts
to resolve it's paths first, but that also has it's own problems like files not getting run through the vite plugin pipeline, etc.
CMIIW
from vite.
having this ability would be great, especially in a nx monorepo.
i usually need to call certain functions in from other packages in the vite.config.ts
from vite.
Closing this as it's something we don't plan on supporting for now.
from vite.
Related Issues (20)
- Upgrade to chokidar v4 HOT 2
- Error: [plugin ] Cannot convert undefined or null to object when running Qwik-TS TypeScript in Vite HOT 3
- Problem with resolving SASS files when the build files are in a subfolder HOT 2
- Windows + yarn pnp: [vite] Get yarn cache dir error: spawnSync C:\Windows\system32\cmd.exe ENOENT HOT 1
- Uncaught ReferenceError: __DEFINES__ is not defined at env.ts:17:17 HOT 1
- Referenced Project May Not Disable Emit HOT 1
- SSR transform sets `map.sources` paths incorrectly HOT 1
- [vite:plugin-legacy] Specify path for polyfills file HOT 1
- [vite:plugin-legacy] Polyfills fail to load when using <base href... /> HOT 1
- Top level await for import() function stopped working in Chrome HOT 8
- Sass Deprecation Warning when building Vue project with Vite HOT 16
- jsx preserve does not work HOT 4
- Configuring server headers has no effect HOT 2
- Why the src of audio in index.html diffrent with video after build HOT 2
- I want to insert js file into the body of HTML but I didn't find the configuration item
- [Bun + Vike.js] RangeError: Maximum call stack size exceeded - __vite_ssr_import_2__.serve is not a function HOT 1
- thread '<unnamed>' panicked - I don't know how to reproduce HOT 2
- Random errors using dev server in Firefox: "Loading failed for the module with source" & NS_ERROR_NET_PARTIAL_TRANSFER
- If I import and use the PackageImporter from sass, the build outputs an error. HOT 2
- Proxy css as js through alias HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vite.