vike
Version:
The Framework *You* Control - Next.js & Nuxt alternative for unprecedented flexibility and dependability.
17 lines (16 loc) • 616 B
JavaScript
export { isDevCheck };
export { applyDev };
export { applyPreview };
import { assertUsage } from './assert.js';
function isDevCheck(configEnv) {
const { isPreview, command } = configEnv;
// `assertVersion('Vite', version, '5.1.0')` isn't enough: https://github.com/vitejs/vite/pull/19355
assertUsage(typeof isPreview === 'boolean', 'You are using an old Vite version; make sure to use Vite 5.1.0 or above.');
return command === 'serve' && !isPreview;
}
function applyDev(_, env) {
return isDevCheck(env);
}
function applyPreview(_, env) {
return env.command == 'serve' && !isDevCheck(env);
}