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
Error: Cannot read properties of undefined (reading 'location')
at ESMLoader.import (https://stackblitzstartersw8bzdo-ywrm.w-credentialless.staticblitz.com/blitz.1df59e15.js:35:1312912)
at i.loadESM (https://stackblitzstartersw8bzdo-ywrm.w-credentialless.staticblitz.com/blitz.1df59e15.js:35:315882)
at handleMainPromise (https://stackblitzstartersw8bzdo-ywrm.w-credentialless.staticblitz.com/blitz.1df59e15.js:35:1079791)
Error: Cannot read properties of undefined (reading 'location')
at ESMLoader.import (https://stackblitzstartersw8bzdo-ywrm.w-credentialless.staticblitz.com/blitz.1df59e15.js:35:1312912)
at i.loadESM (https://stackblitzstartersw8bzdo-ywrm.w-credentialless.staticblitz.com/blitz.1df59e15.js:35:315882)
at handleMainPromise (https://stackblitzstartersw8bzdo-ywrm.w-credentialless.staticblitz.com/blitz.1df59e15.js:35:1079791)
Describe the bug
I am using
vite-node
to evaluate some of our code to get values from it. Using the base setup from README.The snippet is following:
Execution is fails with:
It fails on
document.location
and other accesses todocument
, for example: https://github.com/storybookjs/storybook/blob/d8a18a9642ea43c7d70ed6c762caf2822a643aa0/code/lib/preview-api/src/modules/preview-web/UrlStore.ts#L25The question is tricky, should
vite-node
handle such cases? What is the expectation?Reproduction
node index.mjs
System Info
Used Package Manager
npm
Validations
The text was updated successfully, but these errors were encountered: