[ty] fix ty playground initialization and vite optimization issues

This commit is contained in:
Shunsuke Shibayama 2025-11-15 20:07:23 +09:00
parent 698231a47a
commit 981ce98c83
2 changed files with 3 additions and 3 deletions

View file

@ -501,7 +501,7 @@ export interface InitializedPlayground {
// Run once during startup. Initializes monaco, loads the wasm file, and restores the previous editor state. // Run once during startup. Initializes monaco, loads the wasm file, and restores the previous editor state.
async function startPlayground(): Promise<InitializedPlayground> { async function startPlayground(): Promise<InitializedPlayground> {
const ty = await import("../ty_wasm"); const ty = await import("ty_wasm");
await ty.default(); await ty.default();
const version = ty.version(); const version = ty.version();
const monaco = await loader.init(); const monaco = await loader.init();

View file

@ -15,7 +15,7 @@ const PYODIDE_EXCLUDE = [
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig({ export default defineConfig({
plugins: [react(), tailwindcss(), viteStaticCopyPyodide()], plugins: [react(), tailwindcss(), viteStaticCopyPyodide()],
optimizeDeps: { exclude: ["pyodide"] }, optimizeDeps: { exclude: ["pyodide", "ty_wasm"] },
}); });
export function viteStaticCopyPyodide() { export function viteStaticCopyPyodide() {
@ -23,7 +23,7 @@ export function viteStaticCopyPyodide() {
return viteStaticCopy({ return viteStaticCopy({
targets: [ targets: [
{ {
src: [join(pyodideDir, "*"), ...PYODIDE_EXCLUDE], src: [join(pyodideDir, "*").replace(/\\/g, "/"), ...PYODIDE_EXCLUDE],
dest: "assets", dest: "assets",
}, },
], ],