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

"Stumbled upon a Vike bug" with vanilla-extract and prerender: true #1791

Closed
bard opened this issue Aug 6, 2024 · 5 comments
Closed

"Stumbled upon a Vike bug" with vanilla-extract and prerender: true #1791

bard opened this issue Aug 6, 2024 · 5 comments
Labels

Comments

@bard
Copy link

bard commented Aug 6, 2024

Description

5:42:44 PM [vike][Warning] Vite's development server was instantiated while the environment is set to be a production environment by process.env.NODE_ENV === "production" which is contradictory, see https://vike.dev/NODE_ENV
Error: [vike@0.4.182][Bug] You stumbled upon a Vike bug. Go to https://github.com/vikejs/vike/issues/new and copy-paste this error. A maintainer will fix the bug (usually under 24 hours).
    at initGlobalContext (file:///tmp/project/node_modules/.pnpm/vike@0.4.182_react-streaming@0.3.43_react-dom@18.3.1_react@18.3.1__react@18.3.1__vite@5.3.5_@types+node@22.1.0_/node_modules/vike/dist/esm/node/runtime/globalContext.js:90:9)
    at runPrerender (file:///tmp/project/node_modules/.pnpm/vike@0.4.182_react-streaming@0.3.43_react-dom@18.3.1_react@18.3.1__react@18.3.1__vite@5.3.5_@types+node@22.1.0_/node_modules/vike/dist/esm/node/prerender/runPrerender.js:81:11)
    at runPrerenderFromAutoFullBuild (file:///tmp/project/node_modules/.pnpm/vike@0.4.182_react-streaming@0.3.43_react-dom@18.3.1_react@18.3.1__react@18.3.1__vite@5.3.5_@types+node@22.1.0_/node_modules/vike/dist/esm/node/prerender/runPrerender.js:48:9)
    at triggerFullBuild (file:///tmp/project/node_modules/.pnpm/vike@0.4.182_react-streaming@0.3.43_react-dom@18.3.1_react@18.3.1__react@18.3.1__vite@5.3.5_@types+node@22.1.0_/node_modules/vike/dist/esm/node/plugin/plugins/autoFullBuild.js:92:9)
    at Object.handler (file:///tmp/project/node_modules/.pnpm/vike@0.4.182_react-streaming@0.3.43_react-dom@18.3.1_react@18.3.1__react@18.3.1__vite@5.3.5_@types+node@22.1.0_/node_modules/vike/dist/esm/node/plugin/plugins/autoFullBuild.js:31:25)
    at async Promise.all (index 0)
    at PluginDriver.hookParallel (file:///tmp/project/node_modules/.pnpm/rollup@4.18.0/node_modules/rollup/dist/es/shared/node-entry.js:19702:9)
    at file:///tmp/project/node_modules/.pnpm/rollup@4.18.0/node_modules/rollup/dist/es/shared/node-entry.js:20699:13

Probably related: #1592

Only happening on vite build. Based on the warning at the beginning, I tried both NODE_ENV=development vite build and NODE_ENV=production vite build, no difference.

  • vite: 5.3.5
  • vike: 0.4.182
  • vike-react: 0.5.1
  • @vanilla-extract/css 1.15.1
  • @vanilla-extract/vite-plugin 4.0.13

vite.config.ts:

import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";
import vike from "vike/plugin";
import { vanillaExtractPlugin } from "@vanilla-extract/vite-plugin";

export default defineConfig({
  plugins: [vike({ prerender: true }), react({}), vanillaExtractPlugin({})],
});

Removing vanillaExtractPlugin and VE-based styles allows the build to complete. Likewise if I remove prerender: true.

@bard bard added the bug 💥 label Aug 6, 2024
@bard
Copy link
Author

bard commented Aug 6, 2024

Worked around by locking @vanilla-extract/vite-plugin at 4.0.0. The first version that triggers the problem is 4.0.1.

@brillout
Copy link
Member

brillout commented Aug 7, 2024

Can you publish a reproduction?

@bard
Copy link
Author

bard commented Aug 7, 2024

@brillout
Copy link
Member

brillout commented Aug 9, 2024

Fix pre-released in 0.4.183-commit-38f60f1. The build should now pass. Let me know if you stumble upon any other issues.

In case your company is up for it, we're looking for sponsors (#1350). It makes a big difference to us!

@bard
Copy link
Author

bard commented Aug 9, 2024

Confirmed as working. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants