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
When importing certain modules with cyclical imports vitest will evaluate a file before it's imports are undefined, causing unexpected TypeError: _ is undefined errors. The module can be imported as native ESM in node and works in esbuild.
The issue is related to import * as dom from "./dom/index.js"; in Ion.js. If that is replaced with export * as dom from './dom/index.js' or import { Blob } from './dom/Blob.js' the issue doesn't reproduce.
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
Describe the bug
I originally reported this in vitest-dev/vitest#4143 but now I can reproduce in vite.
When importing certain modules with cyclical imports vitest will evaluate a file before it's imports are undefined, causing unexpected
TypeError: _ is undefined
errors. The module can be imported as native ESM in node and works in esbuild.Reproduction
https://stackblitz.com/edit/vitejs-vite-bouzoh?file=server.js
Steps to reproduce
I found this bug when using https://github.com/amazon-ion/ion-js. Here's a simplified version that reproduces the issue
The issue is related to
import * as dom from "./dom/index.js";
in Ion.js. If that is replaced withexport * as dom from './dom/index.js'
orimport { Blob } from './dom/Blob.js'
the issue doesn't reproduce.System Info
System: OS: Linux 5.0 undefined CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz Memory: 0 Bytes / 0 Bytes Shell: 1.0 - /bin/jsh Binaries: Node: 16.20.0 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 9.4.2 - /usr/local/bin/npm pnpm: 8.6.10 - /usr/local/bin/pnpm npmPackages: vite: ^4.4.9 => 4.4.9
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: