-
-
Notifications
You must be signed in to change notification settings - Fork 8k
Description
Description
Some plugin configurations require a complex object that might be split across the codebase
For instance, CRXJS Vite Plugin requires a manifest.json file, which might/might not require an (possible aliased) import from another file
Reproduction link here
Right now, vite does not resolve alias paths within vite.config.ts or it's dependencies
- src/
- some-other-module/
- foo.ts
- config/
- index.ts
- vite.config.ts
- tsconfig.json
Example of such case:
// src/config/index.ts
// throws an error even when tsconfig.json defines compilerOptions.paths properly
import { Something } from "@/some-other-module/foo";
...
// vite.config.ts
import { someConfig } from "./src/config";
...Example of another case:
// vite.config.ts
// throws an error even when tsconfig.json defines compilerOptions.paths properly
import { someConfig } from "@/config";
...Both cases will throw error when running an instance of the vite server
Suggested solution
Maybe consider using compilerOptions.paths to resolve the imports in vite.config.ts somewhere in the plugin pipeline
Alternative
I'm also considering creating a plugin that creates a workaround, still not 100% sure on how to accomplish this though
Additional context
I've received quite a bit of concern and confusion regarding consumers of vite not being able to utilize aliases in vite.config.ts, and I believe it'd be an issue worth looking at
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.