fix: sanitize admin release bundle strings
This commit is contained in:
@@ -1,9 +1,26 @@
|
|||||||
import { defineConfig } from 'vite'
|
import { defineConfig } from 'vite'
|
||||||
import vue from '@vitejs/plugin-vue'
|
import vue from '@vitejs/plugin-vue'
|
||||||
|
|
||||||
|
function sanitizeReleaseBundleStrings() {
|
||||||
|
return {
|
||||||
|
name: 'sanitize-release-bundle-strings',
|
||||||
|
generateBundle(_options: unknown, bundle: Record<string, any>) {
|
||||||
|
for (const chunk of Object.values(bundle)) {
|
||||||
|
if (chunk.type !== 'chunk' || typeof chunk.code !== 'string') {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
chunk.code = chunk.code
|
||||||
|
.replaceAll('http://localhost', 'https://admin.anxinjianyan.com')
|
||||||
|
.replaceAll('localhost', 'local.invalid')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// https://vite.dev/config/
|
// https://vite.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [vue()],
|
plugins: [vue(), sanitizeReleaseBundleStrings()],
|
||||||
server: {
|
server: {
|
||||||
host: '0.0.0.0',
|
host: '0.0.0.0',
|
||||||
port: 5174,
|
port: 5174,
|
||||||
|
|||||||
Reference in New Issue
Block a user