aleclarson / vite-tsconfig-paths

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

TSConfig imports do not work in WebWorkers #46

Closed darkevilmac closed 2 years ago

darkevilmac commented 2 years ago

I'm trying to use WebWorkers with this plugin using the built in tooling provided by Vite.

Unfortunately I get issues when the worker is invoked, it's unable to resolve any imports using the tsconfig file and will only work if I continue to use relative imports.

I've also tested this using the resolve alias feature in the Vite config and it worked as expected, so the issue is isolated to the plugin itself.

I've setup a stackblitz where you can see the issue directly, if there's any more info you need from me just let me know.

https://stackblitz.com/edit/vite-tsconfigpaths-webworker

aleclarson commented 2 years ago

what do the debug logs say?

DEBUG="vite-tsconfig-paths" vite
darkevilmac commented 2 years ago

Gave that a run in the stackblitz container, here's the output.

https://gist.github.com/darkevilmac/3214cc763f63c4bcca1b87566acd0878

aleclarson commented 2 years ago

Released in v3.4.1

Please help me boost my Github sponsor count for as little as $1 as a token of appreciation for this plugin 😏

laurentpayot commented 2 years ago

By the way tsconfig-paths just bumped to v4.0 ...

laurentpayot commented 2 years ago

I just deleted my previous comment about the build issue. I forgot to add the plugin in the vite worker options :man_facepalming: Thanks @aleclarson :+1: