-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
Describe the bug
In Javascript, imports are hoisted. So the following code works
decamelize("HelloThere")
import decamelize from 'decamelized'
But when transformed in vite-node, it produces the following
__vite_ssr_import_0__.default("HelloThere");
const __vite_ssr_import_0__ = await __vite_ssr_import__("decamelize");
Which obviously doesn't work and produces the following error
Cannot access '__vite_ssr_import_0__' before initialization
Reproduction
https://stackblitz.com/edit/vitest-dev-vitest-jw9dyp?file=index.js&initialPath=__vitest__
- run
node index.js - run
vite-node index.jsand you will see the error
System Info
System:
OS: macOS 12.4
CPU: (10) arm64 Apple M1 Max
Memory: 1.60 GB / 32.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.17.0 - /usr/local/bin/node
Yarn: 1.22.17 - /usr/local/bin/yarn
npm: 8.15.0 - /usr/local/bin/npm
Browsers:
Chrome: 106.0.5249.103
Chrome Canary: 108.0.5352.2
Safari: 15.5
Safari Technology Preview: 16.4
npmPackages:
vite: ^3.1.0 => 3.1.0Used Package Manager
npm
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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels