aboutsummaryrefslogtreecommitdiff
path: root/web/pw-server/svelte.config.js
blob: 197fa56b5141d36a58cb7b8ed47dac27eeb0be63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import adapter from "@sveltejs/adapter-node";
import sveltePreprocess from "svelte-preprocess";
import { viteCommonjs } from "@originjs/vite-plugin-commonjs";
import wasmPack from "vite-plugin-wasm-pack";
import { isoImport } from "vite-plugin-iso-import";
import { mdsvex } from "mdsvex";

/** @type {import('@sveltejs/kit').Config} */
const config = {
  // Consult https://github.com/sveltejs/svelte-preprocess
  // for more information about preprocessors
  preprocess: [
    sveltePreprocess(),
    mdsvex({
      extensions: ['.md']
    }),
  ],
  extensions: ['.svelte', '.md'],
  kit: {
    adapter: adapter(),

    // hydrate the <div id="svelte"> element in src/app.html
    // target: "#svelte",
    vite: {
      plugins: [
        isoImport(),
        wasmPack([], ["planetwars-rs"]),
        viteCommonjs({
          transformMixedEsModules: true,
        }),
      ],
      build: {
        commonjsOptions: {
          transformMixedEsModules: true,
        },
      },
      server: {
        proxy: {
          "/api/": "http://127.0.0.1:9000",
          "/ws": "ws://localhost:9000/ws",
        },
        fs: {
          // Allow serving files from one level up to the project root
          allow: [".."],
        },
      },
    },
  },
};

export default config;