Skip to content

Commit

Permalink
dev use local wasm & data
Browse files Browse the repository at this point in the history
  • Loading branch information
iFwu committed Oct 7, 2024
1 parent b43b0ba commit c817ce6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/chessEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@ export class ChessEngine {
(window as any).Pikafish = Pikafish;
this.engineInstance = await Pikafish({
locateFile: (file: string) => {
if (import.meta.env.DEV) {
return file === 'pikafish.data'
? `${import.meta.env.BASE_URL}wasm/data/${file}`
: `${import.meta.env.BASE_URL}wasm/${file}`;
}
return file === 'pikafish.data'
? 'https://xiangqiai.com/wasm/data/pikafish.data'
? `https://xiangqiai.com/wasm/data/${file}`
: `https://xiangqiai.com/wasm/single/${file}`;
},
});
Expand Down

0 comments on commit c817ce6

Please sign in to comment.