aboutsummaryrefslogtreecommitdiff
path: root/extension/vite.config.js
blob: d28c0f7e749f6f4fe3e2fcfb7f66a00eca30d669 (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import { defineConfig, loadEnv } from "vite";
import vue from "@vitejs/plugin-vue";
import webExtension from "@samrum/vite-plugin-web-extension";
import path from "path";
import postcss from './postcss.config.js'
import { getManifest } from "./src/manifest";

// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
  const env = loadEnv(mode, process.cwd(), "");

  return {
    preview: {
      port: 6896,
    },
    server: {
      host: '0.0.0.0',
      port: 6896,
      strictPort: true,
      proxy: {
        '/public': {
          target: 'https://www.vaughnnugent.com/public',
          changeOrigin: true,
          rewrite: (path) => path.replace(/^\/public/, ''),
          headers: {
            //Don't send cookies to the remote server
            'cookies': ""
          }
        },
        '/api': {
          target: 'http://127.0.0.1:8089',
          changeOrigin: true,
          rewrite: (path) => path.replace(/^\/api/, ''),
        }
      }
    },
    plugins: [
      vue(),
      webExtension({
        manifest: getManifest(Number(env.MANIFEST_VERSION)),

        additionalInputs: {
          scripts: [
            'src/entries/nostr-provider.js', // defaults to webAccessible: true
          ],
        },
      }),
    ],
    resolve: {
      alias: {
        "~": path.resolve(__dirname, "./src"),
      },
    },
    build: {
      cssCodeSplit: true,
      rollupOptions: {
        plugins: [],
      },
    },
    optimizeDeps: {
      exclude: ['']
    },
    css: {
      postcss: postcss
    },
  };
});