Closed Aaronius closed 1 year ago
I believe I have the same error
When I don't set up vite-tsconfig-paths I get an error importing 'b' in the file in a/index.ts
When I have vite-tsconfig-paths set up I get an error import package 'c' in package 'b'
So it seems vite-tsconfig-paths is working for the first "layer" of import from a separate package, but is then having an issue importing another package within the first dependency
@Aaronius Vite only loads the nearest vite.config.js
file. The others aren't loaded. You can use the root
option to help the plugin find your other tsconfig.json
files. From the stack trace, it looks like your packages (other than @foo/demos
) are being optimized by Vite, which might prevent root
from working (but maybe not a problem).
https://github.com/aleclarson/vite-tsconfig-paths/wiki/Troubleshooting#you-may-need-the-root-option
Here's my setup. I have a monorepo. In that monorepo, I have @taxbit/demos which uses @taxbit/browser which uses @taxbit/rest (all three are on the same repo). When I run vite on @taxbit/demos, I get the following error:
Here are my files:
@taxbit/demos tsconfig.json:
@taxbit/demos vite.config.json
@taxbit/browser tsconfig.json:
@taxbit/browser vite.config.json:
@taxbit/rest tsconfig.json:
@taxbit/rest vite.config.json:
When I don't use
vite-tsconfig-paths
, but instead manually configureresolve.alias
within vite.config.json, I don't get an error. Here's what my vite.config.json files look like when manually configured:@taxbit/demos vite.config.json:
@taxbit/browser vite.config.json
@taxbit/rest vite.config.json
I'm still pretty new at configuring TS and Vite, so it's very possible I'm misunderstanding something. Thanks for the help!