planetwars.dev/web/pw-server/svelte.config.js

46 lines
1.1 KiB
JavaScript
Raw Normal View History

2022-02-24 18:38:17 +01:00
import adapter from "@sveltejs/adapter-node";
2021-12-31 11:38:06 +01:00
import preprocess from "svelte-preprocess";
import { viteCommonjs } from "@originjs/vite-plugin-commonjs";
import wasmPack from "vite-plugin-wasm-pack";
import { isoImport } from "vite-plugin-iso-import";
2021-12-30 14:15:40 +01:00
/** @type {import('@sveltejs/kit').Config} */
const config = {
2021-12-31 11:38:06 +01:00
// Consult https://github.com/sveltejs/svelte-preprocess
// for more information about preprocessors
preprocess: preprocess(),
2021-12-30 14:15:40 +01:00
2021-12-31 11:38:06 +01:00
kit: {
adapter: adapter(),
2021-12-30 14:15:40 +01:00
2021-12-31 11:38:06 +01:00
// hydrate the <div id="svelte"> element in src/app.html
2022-02-24 18:47:36 +01:00
// target: "#svelte",
2021-12-31 11:38:06 +01:00
vite: {
plugins: [
isoImport(),
2022-01-02 17:57:40 +01:00
wasmPack([], ["planetwars-rs"]),
2021-12-31 11:38:06 +01:00
viteCommonjs({
transformMixedEsModules: true,
}),
],
build: {
commonjsOptions: {
transformMixedEsModules: true,
},
},
server: {
proxy: {
2022-02-24 18:47:36 +01:00
"/api/": "http://127.0.0.1:9000",
2021-12-31 11:38:06 +01:00
"/ws": "ws://localhost:9000/ws",
},
fs: {
// Allow serving files from one level up to the project root
allow: [".."],
},
},
},
},
2021-12-30 14:15:40 +01:00
};
export default config;