Skip to content

Commit

Permalink
fix import wasmer-js
Browse files Browse the repository at this point in the history
  • Loading branch information
Syuparn committed Feb 25, 2024
1 parent d29499d commit 94f0cd6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion playground/src/lox.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { init, Wasmer } from "@wasmer/sdk";
// HACK: import dynamically to avoid `ReferenceError: document is not defined`
// https://docs.wasmer.io/javascript-sdk/explainers/troubleshooting#referenceerror-document-is-not-defined
const { init, Wasmer } = await import("@wasmer/sdk");

export type LoxResult = {
code: number;
Expand Down
6 changes: 6 additions & 0 deletions playground/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ import react from '@vitejs/plugin-react'

// https://vitejs.dev/config/
export default defineConfig({
// HACK: import dynamically to avoid `ReferenceError: document is not defined`
build: {
modulePreload: {
polyfill: false,
},
},
plugins: [react()],
// HACK: fix link path because endpoint of GitHub pages is https://syuparn.github.io/onylox/ (not root)
base: process.env.GITHUB_PAGES
Expand Down

0 comments on commit 94f0cd6

Please sign in to comment.