-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.js
38 lines (36 loc) · 1.01 KB
/
vite.config.js
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
import { defineConfig } from 'vite'
import { viteStaticCopy } from 'vite-plugin-static-copy'
import process from 'node:process'
// Matches ddev web_extra_exposed_ports.https_port
const HTTPS_PORT = 3000
export default defineConfig(({ command }) => {
return {
base: command === 'serve' ? '' : '/dist/',
build: {
manifest: true,
outDir: './web/dist/',
rollupOptions: {
input: {
app: 'src/js/app.js',
},
},
},
server: {
host: '0.0.0.0',
strictPort: true,
// Matches ddev web_extra_exposed_ports.container_port
port: 3000,
// Strips custom ports from DDEV_PRIMARY_URL if present
origin: `${process.env.DDEV_PRIMARY_URL?.replace(/:\d+$/, '')}:${HTTPS_PORT}`,
allowedHosts: ['.ddev.site'],
cors: {
origin: /https?:\/\/([A-Za-z0-9\-.]+)?(\.ddev\.site)(?::\d+)?$/,
},
},
plugins: [
viteStaticCopy({
targets: [{ src: 'src/icons/**/*', dest: './assets/icons' }],
}),
],
}
})