fix: lazily load deno vite plugin (#3292)
This commit is contained in:
@@ -13,6 +13,7 @@ import { buildIdPlugin } from "./plugins/build_id.ts";
|
|||||||
import { clientSnapshot } from "./plugins/client_snapshot.ts";
|
import { clientSnapshot } from "./plugins/client_snapshot.ts";
|
||||||
import { serverSnapshot } from "./plugins/server_snapshot.ts";
|
import { serverSnapshot } from "./plugins/server_snapshot.ts";
|
||||||
import { patches } from "./plugins/patches.ts";
|
import { patches } from "./plugins/patches.ts";
|
||||||
|
import process from "node:process";
|
||||||
|
|
||||||
export function fresh(config?: FreshViteConfig): Plugin[] {
|
export function fresh(config?: FreshViteConfig): Plugin[] {
|
||||||
const fConfig: ResolvedFreshViteConfig = {
|
const fConfig: ResolvedFreshViteConfig = {
|
||||||
@@ -23,7 +24,7 @@ export function fresh(config?: FreshViteConfig): Plugin[] {
|
|||||||
ignore: config?.ignore ?? [],
|
ignore: config?.ignore ?? [],
|
||||||
};
|
};
|
||||||
|
|
||||||
return [
|
const plugins: Plugin[] = [
|
||||||
{
|
{
|
||||||
name: "fresh",
|
name: "fresh",
|
||||||
config(config, env) {
|
config(config, env) {
|
||||||
@@ -123,6 +124,11 @@ export function fresh(config?: FreshViteConfig): Plugin[] {
|
|||||||
"topLevelAwait",
|
"topLevelAwait",
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
deno(),
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if (typeof process.versions.deno === "string") {
|
||||||
|
plugins.push(deno());
|
||||||
|
}
|
||||||
|
|
||||||
|
return plugins;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user