vite-plugin-checker icon indicating copy to clipboard operation
vite-plugin-checker copied to clipboard

The plugin should follow up the Vite's `resolve.alias` declarations

Open sashapetrovska opened this issue 3 years ago • 4 comments

Describe the bug

I have my mapped aliases pointing to my local libraries and they're not being resolved, I know I can map them using the tsconfig inside of compilerOptions.paths, but it's really annoying.

Reproduction

Define a new alias in vite.config.js, and try to import it globally.

Expected behavior

Import the modules using its respective aliases defined inside of vite.config.js.

System Info

N/A

Additional context

N/A

Validations

  • [X] Read the docs.
  • [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.

sashapetrovska avatar Jul 27 '22 00:07 sashapetrovska

If you're saying that tsc checker requires a compilerOptions.paths, that's by design. This plugin aims to provide an original tsc diagnostic.

fi3ework avatar Jul 27 '22 03:07 fi3ework

If you're saying that tsc checker requires a compilerOptions.paths, that's by design. This plugin aims to provide an original tsc diagnostic.

I know right, but shouldn't it rely on the Vite's config?, AFAIK, that's what a plugin does, otherwise I'd just run my tsc manually without even installing a plugin. in the other hand, I don't see how resolve.alias should differ against compilerOptions.paths when resolving imports.

sashapetrovska avatar Jul 27 '22 20:07 sashapetrovska

otherwise I'd just run my tsc manually without even installing a plugin

Yes, you can. This plugin provides a way to consume errors on the web page. You can treat it as the https://www.npmjs.com/package/fork-ts-checker-webpack-plugin for Vite.

in the other hand, I don't see how resolve.alias should differ against compilerOptions.paths when resolving imports.

The resolve.alias will guide Vite to how the modules should be resolved with alias. While compilerOptions.paths is for TypeScript to do type check with alias. The plugin should keep behaviors with tsc.

fi3ework avatar Jul 28 '22 05:07 fi3ework

well, another bug I just found, is it doesn't resolve the sass named exports, image

while Vite will build successfully. I see isn't a completely Vite integrated plugin as you told me before, but I wish it was.

sashapetrovska avatar Aug 08 '22 22:08 sashapetrovska

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is a bug report, please provide a minimal re-production repository or use path to reproduce. Thank you for your contributions.

stale[bot] avatar Oct 08 '22 05:10 stale[bot]

@SashaPetrovska Should declare types for .scss modules for TypeScript. I believe this error would happen with a vanilla tsc --noEmit. Closed for upstream usage. Feel free to re-open if you find it's a plugin-specified bug.

fi3ework avatar Jan 23 '23 10:01 fi3ework