mirror of
https://gitee.com/dromara/go-view.git
synced 2025-04-06 03:58:04 +08:00
build: 修改打包配置
This commit is contained in:
parent
63ed00bd28
commit
4e1069ec1d
@ -1,37 +1,45 @@
|
|||||||
import { defineConfig } from 'vite'
|
import { defineConfig } from 'vite'
|
||||||
import vue from '@vitejs/plugin-vue'
|
import vue from '@vitejs/plugin-vue'
|
||||||
import { resolve } from "path"
|
import { resolve } from 'path'
|
||||||
import { OUTPUT_DIR } from './build/constant'
|
import { OUTPUT_DIR } from './build/constant'
|
||||||
|
import viteCompression from 'vite-plugin-compression'
|
||||||
|
|
||||||
function pathResolve(dir: string) {
|
function pathResolve(dir: string) {
|
||||||
return resolve(process.cwd(), '.', dir);
|
return resolve(process.cwd(), '.', dir)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
base: "./",
|
base: './',
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: [
|
alias: [
|
||||||
{
|
{
|
||||||
find: /\/#\//,
|
find: /\/#\//,
|
||||||
replacement: pathResolve('types') + '/',
|
replacement: pathResolve('types') + '/'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
find: '@',
|
find: '@',
|
||||||
replacement: pathResolve('src') + '/',
|
replacement: pathResolve('src') + '/'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
dedupe: ['vue'],
|
dedupe: ['vue']
|
||||||
},
|
},
|
||||||
css: {
|
css: {
|
||||||
preprocessorOptions: {
|
preprocessorOptions: {
|
||||||
scss: {
|
scss: {
|
||||||
javascriptEnabled: true,
|
javascriptEnabled: true,
|
||||||
additionalData: `@import "src/styles/common/style.scss";`,
|
additionalData: `@import "src/styles/common/style.scss";`
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
vue()
|
vue(),
|
||||||
|
viteCompression({
|
||||||
|
verbose: true,
|
||||||
|
disable: false,
|
||||||
|
threshold: 10240,
|
||||||
|
algorithm: 'gzip',
|
||||||
|
ext: '.gz'
|
||||||
|
})
|
||||||
],
|
],
|
||||||
build: {
|
build: {
|
||||||
target: 'es2015',
|
target: 'es2015',
|
||||||
@ -39,9 +47,18 @@ export default defineConfig({
|
|||||||
terserOptions: {
|
terserOptions: {
|
||||||
compress: {
|
compress: {
|
||||||
keep_infinity: true,
|
keep_infinity: true,
|
||||||
},
|
drop_console: true,
|
||||||
|
drop_debugger: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
rollupOptions: {
|
||||||
|
output: {
|
||||||
|
chunkFileNames: 'static/js/[name]-[hash].js',
|
||||||
|
entryFileNames: 'static/js/[name]-[hash].js',
|
||||||
|
assetFileNames: 'static/[ext]/[name]-[hash].[ext]'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
brotliSize: false,
|
brotliSize: false,
|
||||||
chunkSizeWarningLimit: 2000,
|
chunkSizeWarningLimit: 2000
|
||||||
},
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user