Skip to content

Commit

Permalink
Fixup v3
Browse files Browse the repository at this point in the history
  • Loading branch information
kearfy committed Jul 17, 2024
1 parent b37f37e commit ae9bbe7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 19 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
],
"scripts": {
"build": "tsc && pnpm grammar:build && vite build",
"build:desktop": "tsc && pnpm grammar:build && vite build -c vite.config.build.ts",
"build:desktop": "tsc && pnpm grammar:build && vite build -c vite.config.desktop.ts",
"build:embedded": "tsc && pnpm grammar:build && vite build -c vite.config.embedded.ts",
"dev": "vite",
"dev:desktop": "vite -c vite.config.desktop.ts",
Expand Down
11 changes: 1 addition & 10 deletions vite.config.desktop.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,14 @@
import { defineConfig } from 'vite';
import { compression } from 'vite-plugin-compression2';
import { getDefaultConfig, getDefaultPlugins } from './vite.config';

// https://vitejs.dev/config/
export default defineConfig((config) => {
const defaultConfig = getDefaultConfig({
...config,
noCompression: true,
});
const defaultConfig = getDefaultConfig(config);

return {
...defaultConfig,
plugins: [
...getDefaultPlugins(),
compression({
threshold: 100,
deleteOriginalAssets: true,
include: /\.(html|xml|css|json|js|mjs|svg|wasm)$/
})
]
};
});
14 changes: 6 additions & 8 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,14 @@ export const getDefaultPlugins = () => [
})
];

export const getDefaultConfig = ({ mode, noCompression }: { mode?: string; noCompression?: boolean }): UserConfig => ({
export const getDefaultConfig = ({ mode }: { mode?: string }): UserConfig => ({
plugins: [
...getDefaultPlugins(),
...(noCompression ? [] : [
compression({
deleteOriginalAssets: true,
include: /\.(wasm)$/,
filename: (id) => id,
})
]),
compression({
deleteOriginalAssets: true,
include: /\.(wasm)$/,
filename: (id) => id,
})
],
clearScreen: false,
envPrefix: ['VITE_', 'TAURI_'],
Expand Down

0 comments on commit ae9bbe7

Please sign in to comment.