toolshed/frontend/vite.config.js
2023-05-22 01:40:12 +02:00

55 lines
1.8 KiB
JavaScript

import {fileURLToPath, URL} from 'node:url'
import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/
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-Origin': 'http://10.23.42.128:8000, http://10.23.42.168:8000',
'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',
'Content-Security-Policy': 'default-src \'self\' \'unsafe-inline\' \'unsafe-eval\' data: \'self\' connect-src *', // change to https://* for production
},
proxy: {
'^/api/': {
target: "http://127.0.0.1:8000/",
},
'^/auth/': {
target: "http://127.0.0.1:8000/",
},
'^/admin/': {
target: "http://127.0.0.1:8000/",
},
'^/docs/': {
target: "http://127.0.0.1:8000/",
},
'^/static/': {
target: "http://127.0.0.1:8000/",
},
'^/wiki/': {
target: "http://127.0.0.1:8080/",
rewrite: (path) => path.replace(/^\/wiki/, ''),
},
'^/livereload/': {
target: "http://127.0.0.1:8080/",
}
}
},
test: {
include: ['src/tests/**/*.js'],
globals: true,
environment: "jsdom"
}
})