Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid using of import.meta.env.DEV since it's not always available #228

Closed
arianrhodsandlot opened this issue Sep 5, 2024 · 1 comment · Fixed by #236
Closed

Avoid using of import.meta.env.DEV since it's not always available #228

arianrhodsandlot opened this issue Sep 5, 2024 · 1 comment · Fixed by #236
Assignees
Labels
bug Something isn't working

Comments

@arianrhodsandlot
Copy link

System info

System:
OS: macOS 14.6.1
CPU: (8) arm64 Apple M1 Pro
Memory: 182.86 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.12.0 - ~/.local/state/fnm_multishells/18796_1725511489670/bin/node
Yarn: 1.22.22 - /opt/homebrew/bin/yarn
npm: 8.19.2 - ~/.local/state/fnm_multishells/18796_1725511489670/bin/npm
pnpm: 9.9.0 - /opt/homebrew/bin/pnpm
Browsers:
Edge: 128.0.2739.42
Safari: 17.6
npmPackages:
@vueuse/core: 11.0.3 => 11.0.3
@vueuse/motion: 2.2.3 => 2.2.3

Reproduction

https://stackblitz.com/edit/vitejs-vite-umygq7

Describe the bug

When using the Motion component with CSR, it works perfectly. But when it comes to SSR/SSG, the build process crashes with an error message "Cannot read properties of undefined (reading 'DEV')".

The error seems to be from here:

if (import.meta.env.DEV) {

We cannot ensure the import.meta.env is available when the code is running inside a Node.js process.

Additional context

No response

Logs

No response

@BobbieGoede
Copy link
Member

Thanks for reporting and sorry for the late response 🙏

This should be resolved by #236 in v2.2.6, let me know if you're still experiencing issues!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants