-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvite.config.js
38 lines (35 loc) · 944 Bytes
/
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, loadEnv } from 'vite'
import { viteStaticCopy } from 'vite-plugin-static-copy'
import process from 'node:process'
// Match ports in .ddev/config.yaml -> web_extra_exposed_ports
const HTTP_PORT = 3000
const HTTPS_PORT = 3001
export default defineConfig(({ command, mode }) => {
const env = loadEnv(mode, process.cwd(), '')
const originPort = env.PRIMARY_SITE_URL.startsWith('https')
? HTTPS_PORT
: HTTP_PORT
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,
port: HTTP_PORT,
origin: env.PRIMARY_SITE_URL + ':' + originPort,
},
plugins: [
viteStaticCopy({
targets: [{ src: 'src/icons/**/*', dest: './assets/icons' }],
}),
],
}
})