aleclarson / vite-tsconfig-paths

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

Feature request: Allow customizing the files path mapping applies in #4

Closed TrixterTheTux closed 3 years ago

TrixterTheTux commented 3 years ago

Currently, you're not able to configure in which files the path mapping works due to the check here. It'd be nice to allow it to be configured so that you can allow e.g. vue files to import other files using the path mappings (or possibly use tsconfig's include types to automatically detect this?).

aleclarson commented 3 years ago

I'd be fine with allowing .vue files, but we need to make sure the import is within a lang="ts" script.

aleclarson commented 3 years ago

we need to make sure the import is within a lang="ts" script

@yyx990803 Is there an easy way to detect this from within a resolveId hook?

DreierF commented 3 years ago

Would also be nice if the path mappings could optionally be applied to *js files as well. Should maybe even be enabled by default when checkJs is enabled in the tsconfig.json.

aleclarson commented 3 years ago

I've opened a new issue for include support (#8).

Vue modules using <script lang="ts"> work as expected. See the vue-demo branch.

Closing this issue as wontfix since I have no intention of adding custom "importer filtering" myself.