-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathvite.config.ts
66 lines (62 loc) · 1.55 KB
/
vite.config.ts
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
import { defineConfig } from 'vite';
import { svelte } from '@sveltejs/vite-plugin-svelte';
import path, { resolve } from 'path';
const s_PACKAGE_ID = 'modules/tidy5e-sheet';
// https://vitejs.dev/config/
export default defineConfig({
root: 'src/',
base: `/${s_PACKAGE_ID}/`,
publicDir: path.resolve(__dirname, 'public'),
esbuild: {
target: ['es2022'],
minifyIdentifiers: false,
minifySyntax: true,
minifyWhitespace: true,
keepNames: true
},
server: {
port: 30001,
proxy: {
// Serves static files from main Foundry server.
[`^(/${s_PACKAGE_ID}/(assets|lang|packs|tidy5e-sheet.css))`]:
'http://localhost:30000',
// All other paths besides package ID path are served from main Foundry server.
[`^(?!/${s_PACKAGE_ID}/)`]: 'http://localhost:30000',
// Enable socket.io from main Foundry server.
'/socket.io': { target: 'ws://localhost:30000', ws: true },
},
},
resolve: {
alias: {
src: path.resolve('./src'),
},
},
plugins: [svelte({ configFile: '../svelte.config.js' })],
build: {
outDir: path.resolve(__dirname, 'dist'),
emptyOutDir: true,
target: ['es2022'],
lib: {
entry: './main.svelte.ts',
name: 'Tidy5e-Sheet-Kgar',
fileName: 'tidy5e-sheet',
formats: ['es'],
},
rollupOptions: {
output: {
globals: {
svelte: 'svelte',
},
},
},
sourcemap: true,
minify: 'esbuild',
},
css: {
preprocessorOptions: {
scss: {
api: 'modern-compiler',
},
},
},
});