Skip to content

Commit

Permalink
fix: improve error message upon loading vike/plugin in production (fix
Browse files Browse the repository at this point in the history
  • Loading branch information
brillout committed Jan 21, 2024
1 parent b1e5abf commit 4ed9533
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions vike/utils/assertIsNotProductionRuntime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export { markEnvAsVitePreview }
export { markEnvAsVikePluginLoaded }
export { assertEnv }

import { assert } from './assert.js'
import { assert, assertUsage } from './assert.js'
import { assertIsNotBrowser } from './assertIsNotBrowser.js'
import { createDebugger } from './debug.js'
import { getGlobalObject } from './getGlobalObject.js'
Expand Down Expand Up @@ -48,7 +48,10 @@ function assertEnv(): void | undefined {
if (isVitest()) return
const isProduction = !env.isViteDev && !env.isVitePreview
if (isProduction) {
assert(!env.isVikePluginLoaded)
assertUsage(
!env.isVikePluginLoaded,
`Vike's Vite plugin (the vike/plugin module) is being loaded in production which is forbidden`
)
assert(!env.shouldNotBeProduction)
} else {
// This assert() is boring/obvious
Expand Down

0 comments on commit 4ed9533

Please sign in to comment.