2023-10-23 13:12:26 +00:00
|
|
|
import {fileURLToPath, URL} from 'node:url'
|
|
|
|
|
|
|
|
import {defineConfig} from 'vite'
|
|
|
|
import vue from '@vitejs/plugin-vue'
|
|
|
|
|
|
|
|
export default defineConfig({
|
|
|
|
plugins: [vue()],
|
|
|
|
resolve: {
|
|
|
|
alias: {
|
|
|
|
'@': fileURLToPath(new URL('./src', import.meta.url))
|
|
|
|
}
|
|
|
|
},
|
|
|
|
server: {
|
|
|
|
host: true,
|
|
|
|
cors: true,
|
|
|
|
headers: {
|
|
|
|
//allow all origins
|
|
|
|
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS',
|
|
|
|
'Access-Control-Allow-Headers': 'Origin, Content-Type, X-Auth-Token, Authorization, Accept, charset, boundary, Content-Length',
|
|
|
|
'Access-Control-Allow-Credentials': 'true',
|
|
|
|
'Access-Control-Max-Age': '86400',
|
|
|
|
'Content-Security-Policy': 'default-src \'self\';'
|
|
|
|
+ ' script-src \'self\' \'wasm-unsafe-eval\';'
|
|
|
|
+ ' style-src \'self\' \'unsafe-inline\';'
|
|
|
|
+ ' img-src \'self\' data:; '
|
|
|
|
+ ' connect-src * data:', // TODO: change * to https://* for production (probably in nginx config not here)
|
|
|
|
},
|
2023-06-17 08:56:48 +00:00
|
|
|
/*https: {
|
|
|
|
key: fs.readFileSync('privkey.pem'),
|
|
|
|
cert: fs.readFileSync('fullchain.pem')
|
|
|
|
},*/
|
2023-05-11 10:30:57 +00:00
|
|
|
proxy: {
|
|
|
|
'^/api/': {
|
2023-10-28 18:24:25 +00:00
|
|
|
target: "https://toolshed.j3d1.de:8000/",
|
2023-05-11 10:30:57 +00:00
|
|
|
},
|
|
|
|
'^/auth/': {
|
2023-10-28 18:24:25 +00:00
|
|
|
target: "https://toolshed.j3d1.de:8000/",
|
2023-05-11 10:30:57 +00:00
|
|
|
},
|
|
|
|
'^/docs/': {
|
2023-10-28 18:24:25 +00:00
|
|
|
target: "https://toolshed.j3d1.de:8000/",
|
2023-05-11 10:30:57 +00:00
|
|
|
},
|
|
|
|
'^/static/': {
|
2023-10-28 18:24:25 +00:00
|
|
|
target: "https://toolshed.j3d1.de:8000/",
|
2023-05-11 10:30:57 +00:00
|
|
|
},
|
2023-06-28 22:08:22 +00:00
|
|
|
'^/media/': {
|
2023-10-28 18:24:25 +00:00
|
|
|
target: "https://toolshed.j3d1.de:8000/",
|
2023-06-28 22:08:22 +00:00
|
|
|
},
|
2023-05-11 10:30:57 +00:00
|
|
|
'^/wiki/': {
|
|
|
|
target: "http://127.0.0.1:8080/",
|
|
|
|
rewrite: (path) => path.replace(/^\/wiki/, ''),
|
|
|
|
},
|
|
|
|
'^/livereload/': {
|
|
|
|
target: "http://127.0.0.1:8080/",
|
2023-05-11 10:30:57 +00:00
|
|
|
}
|
|
|
|
},
|
2023-05-21 23:40:12 +00:00
|
|
|
},
|
2023-10-23 13:12:26 +00:00
|
|
|
test: {
|
|
|
|
include: ['src/tests/**/*.js'],
|
|
|
|
globals: true,
|
|
|
|
environment: "jsdom"
|
|
|
|
}
|
|
|
|
})
|