From 0b314e4ea922a164526c65c45f602d4a2f533ba5 Mon Sep 17 00:00:00 2001 From: FatttSnake Date: Thu, 14 Mar 2024 16:58:08 +0800 Subject: [PATCH] Optimize: compiler - switch to local esbuild.wasm --- src/renderer/src/components/Playground/compiler.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/renderer/src/components/Playground/compiler.ts b/src/renderer/src/components/Playground/compiler.ts index f560465..bf27348 100644 --- a/src/renderer/src/components/Playground/compiler.ts +++ b/src/renderer/src/components/Playground/compiler.ts @@ -1,6 +1,7 @@ import esbuild, { Loader, OnLoadArgs, Plugin, PluginBuild } from 'esbuild-wasm' import localforage from 'localforage' import axios from 'axios' +import esbuildWasmUrl from 'esbuild-wasm/esbuild.wasm?url' import { IFiles, IImportMap } from '@/components/Playground/shared' import { cssToJs, jsonToJs, addReactImport } from '@/components/Playground/files' @@ -16,7 +17,7 @@ class Compiler { void esbuild .initialize({ worker: true, - wasmURL: 'https://esm.sh/esbuild-wasm@0.20.1/esbuild.wasm' + wasmURL: esbuildWasmUrl }) .finally(() => { this.init = true