vike
Version:
The Framework *You* Control - Next.js & Nuxt alternative for unprecedented flexibility and dependability.
21 lines (20 loc) • 938 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.isDevCheck = isDevCheck;
exports.applyDev = applyDev;
exports.applyPreview = applyPreview;
const assert_js_1 = require("./assert.js");
function isDevCheck(configEnv) {
const { isPreview, command } = configEnv;
// Note that:
// - `assertVersion('Vite', version, '5.1.0')` at node/vite/onLoad.ts isn't enough: https://github.com/vitejs/vite/pull/19355
// - We'll eventually be able to make this an assert() instead of assertUsage() once Vike requires a Vite version that supports this.meta.viteVersion
(0, assert_js_1.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);
}