Commit 285e540b authored by 陈冲's avatar 陈冲

更改vite配置

parent 983ba494
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>小游戏-大屏</title> <title>小游戏-大屏</title>
<style>body{background: #FA6047;}</style> <style>body{background: #FA6047;}</style>
<script>localStorage.setItem('domain', 'https://hddpserver.guocai365.org.cn');</script> <script>localStorage.setItem('domain', '');</script>
</head> </head>
<body> <body>
<div id="app"></div> <div id="app"></div>
......
...@@ -7,25 +7,13 @@ import vue from '@vitejs/plugin-vue' ...@@ -7,25 +7,13 @@ import vue from '@vitejs/plugin-vue'
import vueDevTools from 'vite-plugin-vue-devtools' import vueDevTools from 'vite-plugin-vue-devtools'
const buildBase = '/cc/pc/' const buildBase = '/cc/pc/'
const buildOutDir = 'dist/cc/pc'
function cleanLegacyDistOutput() {
return {
name: 'clean-legacy-dist-output',
closeBundle() {
rmSync(resolve(__dirname, 'dist/assets'), { recursive: true, force: true })
rmSync(resolve(__dirname, 'dist/index.html'), { force: true })
rmSync(resolve(__dirname, 'dist/favicon.ico'), { force: true })
},
}
}
function copyImageAssets() { function copyImageAssets() {
return { return {
name: 'copy-image-assets', name: 'copy-image-assets',
closeBundle() { closeBundle() {
const source = resolve(__dirname, 'src/assets/images') const source = resolve(__dirname, 'src/assets/images')
const target = resolve(__dirname, buildOutDir, 'assets/images') const target = resolve(__dirname, 'dist/assets/images')
if (!existsSync(source)) { if (!existsSync(source)) {
return return
...@@ -41,24 +29,22 @@ function copyImageAssets() { ...@@ -41,24 +29,22 @@ function copyImageAssets() {
export default defineConfig(({ command }) => ({ export default defineConfig(({ command }) => ({
base: command === 'build' ? buildBase : '/', base: command === 'build' ? buildBase : '/',
build: { build: {
outDir: buildOutDir, emptyOutDir: false,
emptyOutDir: true,
}, },
plugins: [ plugins: [
vue(), vue(),
vueDevTools(), vueDevTools(),
copyImageAssets(), copyImageAssets(),
cleanLegacyDistOutput(),
], ],
server: { server: {
proxy: { proxy: {
'/socket.io': { '/socket.io': {
target: 'http://127.0.0.1:8082', target: 'http://192.168.1.23:8082',
changeOrigin: true, changeOrigin: true,
ws: true, ws: true,
}, },
'/manager': { '/manager': {
target: 'http://127.0.0.1:8082', target: 'http://192.168.1.23:8082',
changeOrigin: true, changeOrigin: true,
}, },
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment