mirror of
https://github.com/teoxoy/factorio-blueprint-editor.git
synced 2025-03-19 21:08:03 +02:00
46 lines
1.1 KiB
JavaScript
46 lines
1.1 KiB
JavaScript
import { defineConfig } from 'vite'
|
|
import { viteStaticCopy } from 'vite-plugin-static-copy'
|
|
|
|
const fullReloadAlways = {
|
|
name: 'full-reload',
|
|
handleHotUpdate({ server }) {
|
|
server.ws.send({ type: 'full-reload' })
|
|
return []
|
|
},
|
|
}
|
|
|
|
export default defineConfig(({ command, mode }) => {
|
|
const proxy = {
|
|
'/corsproxy': {
|
|
target: 'https://fbe.teoxoy.com',
|
|
changeOrigin: true,
|
|
},
|
|
}
|
|
if (mode !== 'production') {
|
|
proxy['/data'] = {
|
|
target: 'http://127.0.0.1:8081',
|
|
rewrite: path => path.replace(/^\/data/, ''),
|
|
}
|
|
}
|
|
return {
|
|
build: { sourcemap: true },
|
|
preview: { port: 8080 },
|
|
server: {
|
|
port: 8080,
|
|
proxy,
|
|
},
|
|
plugins: [
|
|
command === 'build'
|
|
? viteStaticCopy({
|
|
targets: [
|
|
{
|
|
src: '../exporter/data/output/*',
|
|
dest: 'data',
|
|
},
|
|
],
|
|
})
|
|
: fullReloadAlways,
|
|
],
|
|
}
|
|
})
|