mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-07 06:56:04 +02:00
tweak vite config
This commit is contained in:
+28
-2
@@ -12,6 +12,28 @@ import vueJsx from '@vitejs/plugin-vue-jsx';
|
|||||||
|
|
||||||
import { languageCodes } from './localization/locales';
|
import { languageCodes } from './localization/locales';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Vite plugin to remove legacy remixicon font files (eot, woff, ttf, svg)
|
||||||
|
* from the build output, keeping only woff2. Saves ~4.5 MB.
|
||||||
|
*
|
||||||
|
* Chrome 144 picks woff2 from the multi-format @font-face src list and
|
||||||
|
* never requests the other formats, so deleting them is safe.
|
||||||
|
*
|
||||||
|
* @returns {import('vite').Plugin}
|
||||||
|
*/
|
||||||
|
function remixiconWoff2Only() {
|
||||||
|
return {
|
||||||
|
name: 'remixicon-woff2-only',
|
||||||
|
generateBundle(_, bundle) {
|
||||||
|
for (const key of Object.keys(bundle)) {
|
||||||
|
if (/remixicon\.(eot|ttf|svg|woff)$/.test(key)) {
|
||||||
|
delete bundle[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param assetId
|
* @param assetId
|
||||||
@@ -48,7 +70,7 @@ function getManualChunk(moduleId) {
|
|||||||
return `i18n/${language}`;
|
return `i18n/${language}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
const defaultAssetName = '[hash][extname]';
|
const defaultAssetName = '[name][extname]';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} name
|
* @param {string} name
|
||||||
@@ -88,6 +110,7 @@ export default defineConfig(({ mode }) => {
|
|||||||
return {
|
return {
|
||||||
base: '',
|
base: '',
|
||||||
plugins: [
|
plugins: [
|
||||||
|
remixiconWoff2Only(),
|
||||||
vue(),
|
vue(),
|
||||||
vueJsx({
|
vueJsx({
|
||||||
tsTransform: 'built-in'
|
tsTransform: 'built-in'
|
||||||
@@ -157,7 +180,10 @@ export default defineConfig(({ mode }) => {
|
|||||||
reportCompressedSize: false,
|
reportCompressedSize: false,
|
||||||
chunkSizeWarningLimit: 5000,
|
chunkSizeWarningLimit: 5000,
|
||||||
sourcemap: buildAndUploadSourceMaps,
|
sourcemap: buildAndUploadSourceMaps,
|
||||||
assetsInlineLimit: 40960,
|
assetsInlineLimit(filePath) {
|
||||||
|
if (isFont(filePath)) return 0;
|
||||||
|
return 40960;
|
||||||
|
},
|
||||||
rolldownOptions: {
|
rolldownOptions: {
|
||||||
preserveEntrySignatures: false,
|
preserveEntrySignatures: false,
|
||||||
input: {
|
input: {
|
||||||
|
|||||||
Reference in New Issue
Block a user