diff --git a/package-lock.json b/package-lock.json index a087c24..03de9d3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -88,8 +88,7 @@ "tailwindcss": "^3.4.3", "typescript": "^5.4.5", "utility-types": "^3.11.0", - "vite": "^5.2.8", - "vite-plugin-static-copy": "^2.0.0" + "vite": "^5.2.8" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -13374,59 +13373,6 @@ } } }, - "node_modules/vite-plugin-static-copy": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/vite-plugin-static-copy/-/vite-plugin-static-copy-2.0.0.tgz", - "integrity": "sha512-b/quFjTUa/RY9t3geIyeeT2GtWEoRI0GawYFFjys5iMLGgVP638NTGu0RoMjwmi8MoZZ3BQw4OQvb1GpVcXZDA==", - "dev": true, - "dependencies": { - "chokidar": "^3.5.3", - "fast-glob": "^3.2.11", - "fs-extra": "^11.1.0", - "picocolors": "^1.0.0" - }, - "engines": { - "node": "^18.0.0 || >=20.0.0" - }, - "peerDependencies": { - "vite": "^5.0.0" - } - }, - "node_modules/vite-plugin-static-copy/node_modules/fs-extra": { - "version": "11.2.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.2.0.tgz", - "integrity": "sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==", - "dev": true, - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, - "engines": { - "node": ">=14.14" - } - }, - "node_modules/vite-plugin-static-copy/node_modules/jsonfile": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", - "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", - "dev": true, - "dependencies": { - "universalify": "^2.0.0" - }, - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "node_modules/vite-plugin-static-copy/node_modules/universalify": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", - "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", - "dev": true, - "engines": { - "node": ">= 10.0.0" - } - }, "node_modules/vite/node_modules/@esbuild/aix-ppc64": { "version": "0.20.2", "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.20.2.tgz", diff --git a/package.json b/package.json index 415487f..d6e9054 100644 --- a/package.json +++ b/package.json @@ -69,8 +69,7 @@ "tailwindcss": "^3.4.3", "typescript": "^5.4.5", "utility-types": "^3.11.0", - "vite": "^5.2.8", - "vite-plugin-static-copy": "^2.0.0" + "vite": "^5.2.8" }, "dependencies": { "@electron-toolkit/preload": "^3.0.1", diff --git a/src/customTypings/pathkit-wasm.d.ts b/src/customTypings/pathkit-wasm.d.ts index 074116e..2de6de2 100644 --- a/src/customTypings/pathkit-wasm.d.ts +++ b/src/customTypings/pathkit-wasm.d.ts @@ -1,7 +1,7 @@ // only the types used are implemented // see https://skia.org/docs/user/modules/pathkit/#api for more declare module 'pathkit-wasm/bin/pathkit' { - function PathKitInit(): Promise; + function PathKitInit(options?: { locateFile: (file: string) => string }): Promise; export interface PathKit { NewPath(): SkPath; diff --git a/src/renderer/src/lib/pathKit.ts b/src/renderer/src/lib/pathKit.ts index 2901d2e..5d3201f 100644 --- a/src/renderer/src/lib/pathKit.ts +++ b/src/renderer/src/lib/pathKit.ts @@ -1,3 +1,4 @@ import PathKitInit from 'pathkit-wasm/bin/pathkit'; +import pathKitWasm from 'pathkit-wasm/bin/pathkit.wasm?url'; -export const pathKitPromise = PathKitInit(); +export const pathKitPromise = PathKitInit({ locateFile: () => pathKitWasm }); diff --git a/vite.config.ts b/vite.config.ts index 7b29d0f..628a82d 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,19 +1,8 @@ import { svelte } from '@sveltejs/vite-plugin-svelte'; import { defineConfig } from 'vite'; -import { viteStaticCopy } from 'vite-plugin-static-copy'; export default defineConfig({ - plugins: [ - svelte({ configFile: '../../svelte.config.mjs' }), - viteStaticCopy({ - targets: [ - { - src: '../../node_modules/pathkit-wasm/bin/pathkit.wasm', - dest: '/', - }, - ], - }), - ], + plugins: [svelte({ configFile: '../../svelte.config.mjs' })], root: 'src/renderer', build: { outDir: '../../build',