Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tirithen/vitest-import-error
A minimal reproduction of the vitest CJS/ESM import errors
https://github.com/tirithen/vitest-import-error
Last synced: about 5 hours ago
JSON representation
A minimal reproduction of the vitest CJS/ESM import errors
- Host: GitHub
- URL: https://github.com/tirithen/vitest-import-error
- Owner: tirithen
- Created: 2024-04-04T12:17:10.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-04-04T12:24:47.000Z (8 months ago)
- Last Synced: 2024-04-15T09:20:40.160Z (7 months ago)
- Language: JavaScript
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
This is a minimal repo to reproduce the import errors that vitest has when
provided a minimal valid vite.config.js.The problem seem to be related to the vitest package not using the exact same
default configuration as vite does, this causes confusion among users and has
generated multiple issues reported around the same problem.In many cases it is possible to add vitest add additional custom configuration
to enable vitest to run the files, but that shows that currently vitest lacks
sane defaults matching the sane defaults of vite.Steps to reproduce:
1. Clone this repo
2. $ cd vitest-import-server
3. $ npm install
4. $ npx vite build
5. $ npx vitestStep 4 builds as expected (produces output in `dist/`), step 5 crashes with the following error:
```
npx vitest
The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.DEV v1.4.0 /home/user/Projects/vitest-import-error
❯ index.test.js (0)
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Failed Suites 1 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
FAIL index.test.js [ index.test.js ]
Error: Failed to resolve entry for package "@jdlien/validator". The package may have incorrect main/module/exports specified in its package.json.
❯ packageEntryFailure node_modules/vite/dist/node/chunks/dep-whKeNLxG.js:48302:17
❯ resolvePackageEntry node_modules/vite/dist/node/chunks/dep-whKeNLxG.js:48299:5
❯ tryNodeResolve node_modules/vite/dist/node/chunks/dep-whKeNLxG.js:48069:20
❯ Context.resolveId node_modules/vite/dist/node/chunks/dep-whKeNLxG.js:47819:28
❯ Object.resolveId node_modules/vite/dist/node/chunks/dep-whKeNLxG.js:51096:64
❯ TransformContext.resolve node_modules/vite/dist/node/chunks/dep-whKeNLxG.js:50787:23
❯ normalizeUrl node_modules/vite/dist/node/chunks/dep-whKeNLxG.js:66083:34
❯ async file:/home/user/Projects/vitest-import-error/node_modules/vite/dist/node/chunks/dep-whKeNLxG.js:66247:47
❯ TransformContext.transform node_modules/vite/dist/node/chunks/dep-whKeNLxG.js:66168:13⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯
Test Files 1 failed (1)
Tests no tests
Start at 14:15:33
Duration 296ms (transform 20ms, setup 0ms, collect 0ms, tests 0ms, environment 0ms, prepare 66ms)FAIL Tests failed. Watching for file changes...
press h to show help, press q to quit
Cancelling test run. Press CTRL+c again to exit forcefully.```