代码拉取完成,页面将自动刷新
同步操作将从 coderlei/markdown2pdf 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
import AutoImport from 'unplugin-auto-import/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import Components from 'unplugin-vue-components/vite'
import { defineConfig, loadEnv } from 'vite'
import viteCompression from 'vite-plugin-compression'
import eslint from 'vite-plugin-eslint'
import { visualizer } from 'rollup-plugin-visualizer'
import externalGlobals from 'rollup-plugin-external-globals'
import viteImagemin from 'vite-plugin-imagemin'
const globals = externalGlobals({
jspdf: 'jspdf',
axios: 'axios',
html2canvas: 'html2canvas'
})
const viteCompressionPlugin = viteCompression({
disable: false,
threshold: 10240 // 如果体积大于阈值,将被压缩,单位为b,体积过小时请不要压缩,以免适得其反
})
const viteImageminPlugin = viteImagemin({
gifsicle: {
optimizationLevel: 7,
interlaced: false
},
optipng: {
optimizationLevel: 7
},
mozjpeg: {
quality: 20
},
pngquant: {
quality: [0.8, 0.9],
speed: 4
},
svgo: {
plugins: [
{
name: 'removeViewBox'
},
{
name: 'removeEmptyAttrs',
active: false
}
]
}
})
export default ({ mode }) => {
const env = loadEnv(mode, process.cwd())
return defineConfig({
plugins: [
vue(),
AutoImport({
resolvers: [ElementPlusResolver()]
}),
Components({
resolvers: [ElementPlusResolver()]
}),
eslint({ lintOnStart: true, cache: false }) // 打包以及启动项目开启eslint检查
],
resolve: {
alias: {
'@': resolve(__dirname, 'src'),
'@@types': resolve(__dirname, 'types')
}
},
esbuild: {
drop: env?.VITE_DROP_CONSOLE === 'true' ? ['console', 'debugger'] : []
},
base: './',
build: {
rollupOptions: {
external: ['jspdf', 'axios', 'html2canvas'],
plugins: [globals, viteCompressionPlugin, viteImageminPlugin, visualizer({ open: true })],
output: {
chunkFileNames: 'js/[name]-[hash].js',
entryFileNames: 'js/[name]-[hash].js',
assetFileNames: '[ext]/[name]-[hash].[ext]',
manualChunks(id) {
if (id.includes('node_modules')) {
return id.toString().split('node_modules/')[1].split('/')[0].toString()
}
}
}
}
}
})
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。