-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathvite.config.js
37 lines (34 loc) · 985 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
import { resolve } from 'path'
import { minifyHtml, injectHtml } from 'vite-plugin-html'
const scalaVersion = '2.13'
// const scalaVersion = '3.0.0-RC3'
// https://vitejs.dev/config/
export default ({ mode }) => {
const mainJS = `./examples/target/scala-${scalaVersion}/formula-examples-${mode === 'production' ? 'opt' : 'fastopt'}/main.js`
const script = `<script type="module" src="${mainJS}"></script>`
return {
server: {
proxy: {
'/api': {
target: 'http://localhost:8088',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '')
},
}
},
publicDir: './examples/src/main/static/public',
plugins: [
...(process.env.NODE_ENV === 'production' ? [minifyHtml(),] : []),
injectHtml({
injectData: {
script
}
})
],
resolve: {
alias: {
'stylesheets': resolve(__dirname, './examples/src/main/static/stylesheets'),
}
}
}
}