Giter VIP home page Giter VIP logo

Comments (11)

bluwy avatar bluwy commented on September 27, 2024 2

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.

stackblitz avatar stackblitz commented on September 27, 2024

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

from vite.

bluwy avatar bluwy commented on September 27, 2024

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.

FreeJ1nG avatar FreeJ1nG commented on September 27, 2024

If we do in the config, it'd need to align with the source code

What does this mean again?

from vite.

bluwy avatar bluwy commented on September 27, 2024

If tsconfig alias would work in a config file, it should also work in your source code files for consistency.

from vite.

FreeJ1nG avatar FreeJ1nG commented on September 27, 2024

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.

FreeJ1nG avatar FreeJ1nG commented on September 27, 2024

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.

aelbore avatar aelbore commented on September 27, 2024

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.

FreeJ1nG avatar FreeJ1nG commented on September 27, 2024

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?

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.

nckirik avatar nckirik commented on September 27, 2024

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.

bluwy avatar bluwy commented on September 27, 2024

Closing this as it's something we don't plan on supporting for now.

from vite.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.