0.26.0 causes TypeError: __vite_ssr_import_1__.default.fileURLToPath is not a function
See original GitHub issueDescribe the bug
The upgrade from 0.25.7 to 0.26.0 causes this crash when running vitest run
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Errors ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Vitest caught 1 unhandled error during the test run.
This might cause false positive tests. Resolve unhandled errors to make sure your tests are not affected.
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Error ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
TypeError: __vite_ssr_import_1__.default.fileURLToPath is not a function
❯ ../../node_modules/vitest/dist/chunk-utils-env.03f840f2.js:256:64
255| const defaultPort = 51204;
256| const EXIT_CODE_RESTART = 43;
257| const API_PATH = "/__vitest_api__";
| ^
258| const configFiles = [
259| "vitest.config.ts",
❯ VitestRunner.directRequest ../../node_modules/vite-node/dist/client.mjs:283:5
❯ VitestRunner.cachedRequest ../../node_modules/vite-node/dist/client.mjs:146:14
❯ VitestRunner.dependencyRequest ../../node_modules/vite-node/dist/client.mjs:181:14
❯ async /node_modules/vitest/dist/chunk-typecheck-constants.3f865d14.js:3:31
❯ VitestRunner.directRequest ../../node_modules/vite-node/dist/client.mjs:283:5
❯ VitestRunner.cachedRequest ../../node_modules/vite-node/dist/client.mjs:146:14
❯ VitestRunner.dependencyRequest ../../node_modules/vite-node/dist/client.mjs:181:14
❯ async .../node_modules/vitest/dist/entry.js:3:31
❯ VitestRunner.directRequest ../../node_modules/vite-node/dist/client.mjs:283:5
Reproduction
Upgrading to 0.26.0
System Info
System:
OS: macOS 13.0.1
CPU: (10) arm64 Apple M1 Pro
Memory: 280.63 MB / 32.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.19.0 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 8.19.3 - /usr/local/bin/npm
Browsers:
Chrome: 108.0.5359.124
Safari: 16.1
Used Package Manager
yarn
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn’t already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Issue Analytics
- State:
- Created 9 months ago
- Reactions:18
- Comments:6 (2 by maintainers)
Top Results From Across the Web
0.26.0 causes TypeError: __vite_ssr_import_1__ ... - GitHub
0.26.0 causes TypeError : __vite_ssr_import_1__.default.fileURLToPath is not a function · Run details · Usage · Workflow file.
Read more >TypeError: (0 , dayjs_1.default) is not a function - Stack Overflow
dayjs does not export a default entry like that; use import * as dayjs from 'dayjs' to import all of it's exports (as...
Read more >IsConnected not a function in next.js app - MongoDB
I get a message saying: “TypeError: client.isConnected is not a function”. I'm new with next.js and mongodb, so I don't get what is ......
Read more >How to solve the "is not a function" error in JavaScript
js we use require() to load external modules and files. This can cause, in some cases, an error like this: TypeError: require(...) is...
Read more >How to Fix “Promise resolver undefined is not a function” in ...
If you're running into the “Promise resolver undefined is not a function” error, your code may look like this new Promise() instead of...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Same issue here. Reverting to 0.25.7 fixes this.
Enabling
deps.interopDefaultdoesn’t work for me either. And, I cannot revert to 0.25, since 0.26 fixed an issue when importing default exports from some dependencies.Here is my reproducible example: https://stackblitz.com/edit/vitest-dev-vitest-qu86fl