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

55 lines
1.3 KiB
JavaScript
Raw Normal View History

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