You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As a user of vitest I would like to self reference the current package by name when importing in a test. This is a builtin node feature for projects which specify "type": "module".
In a monorepo environment with multiple packages, each package will have to be added as an alias, which means all packages will be available from all test code regardless of location.
Ideally, the location of the test should determine how self-reference package names are resolved.
I'll see if I can create a general purpose vite plugin to handle this.
Clear and concise description of the problem
As a user of
vitest
I would like to self reference the current package by name when importing in a test. This is a builtin node feature for projects which specify"type": "module"
.Given a folder structure of:
And files with this content:
I would like to be able to write the following in the test folder. Currently, when I do this I get the following error:
- Error: [vite-node] Failed to load my-package
Suggested solution
I'm not sure whether this is a request that should be raised in
vite
, or should be added as avite-plugin
.Example
Here is a reproduction of the current issue faced: https://stackblitz.com/edit/github-w9fjy7-bba6ny?file=my-package.spec.js
The text was updated successfully, but these errors were encountered: