Skip to content

Commit 24ed18e

Browse files
committed
docs: use local wasm file
1 parent 6b98318 commit 24ed18e

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
"echarts": "^5.5.1",
6565
"echarts-gl": "^2.0.9",
6666
"echarts-liquidfill": "^3.1.0",
67-
"esbuild-wasm": "^0.19.12",
67+
"esbuild-wasm": "^0.23.0",
6868
"eslint": "^7.32.0",
6969
"eslint-plugin-prettier": "^3.4.1",
7070
"eslint-plugin-vue": "^8.7.1",

src/demo/CodeGen.vue

+2-3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import javascript from "highlight.js/lib/languages/javascript";
1616
import typescript from "highlight.js/lib/languages/typescript";
1717
import hljsVuePlugin from "@highlightjs/vue-plugin";
1818
import { initialize, transform } from "esbuild-wasm";
19+
import wasmURL from "esbuild-wasm/esbuild.wasm";
1920
import { track } from "@vercel/analytics";
2021
2122
import { getImportsFromOption } from "./utils/codegen";
@@ -75,9 +76,7 @@ const transformedCode = ref("");
7576
const transformErrors = ref([]);
7677
7778
onMounted(async () => {
78-
await initialize({
79-
wasmURL: "https://cdn.jsdelivr.net/npm/[email protected]/esbuild.wasm"
80-
});
79+
await initialize({ wasmURL });
8180
8281
initializing.value = false;
8382

vue.config.js

+8
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ export default {
2020
.test(/\.svg$/)
2121
.type("asset/source");
2222

23+
config.module
24+
.rule('wasm')
25+
.test(/\.wasm$/)
26+
.type('asset/resource')
27+
.set('generator', {
28+
filename: '[name].[hash:8][ext]'
29+
})
30+
2331
config.plugin("define").tap(([options]) => [
2432
{
2533
...options,

0 commit comments

Comments
 (0)