Skip to content

Commit

Permalink
feat: use swc and lightningcss
Browse files Browse the repository at this point in the history
  • Loading branch information
JellyBrick committed Dec 19, 2024
1 parent a49eea9 commit ae3a289
Show file tree
Hide file tree
Showing 3 changed files with 275 additions and 18 deletions.
11 changes: 7 additions & 4 deletions electron.vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { resolve, dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';

import { UserConfig } from 'vite';
import { defineConfig, defineViteConfig } from 'electron-vite';
import { defineConfig, defineViteConfig, swcPlugin } from 'electron-vite';
import builtinModules from 'builtin-modules';
import viteResolve from 'vite-plugin-resolve';
import Inspect from 'vite-plugin-inspect';
Expand All @@ -24,6 +24,7 @@ export default defineConfig({
main: defineViteConfig(({ mode }) => {
const commonConfig: UserConfig = {
plugins: [
swcPlugin(),
pluginLoader('backend'),
viteResolve({
'virtual:i18n': i18nImporter(),
Expand Down Expand Up @@ -66,13 +67,14 @@ export default defineConfig({
build: {
...commonConfig.build,
minify: true,
cssMinify: true,
cssMinify: 'lightningcss',
},
};
}),
preload: defineViteConfig(({ mode }) => {
const commonConfig: UserConfig = {
plugins: [
swcPlugin(),
pluginLoader('preload'),
viteResolve({
'virtual:i18n': i18nImporter(),
Expand Down Expand Up @@ -114,13 +116,14 @@ export default defineConfig({
build: {
...commonConfig.build,
minify: true,
cssMinify: true,
cssMinify: 'lightningcss',
},
};
}),
renderer: defineViteConfig(({ mode }) => {
const commonConfig: UserConfig = {
plugins: [
swcPlugin(),
pluginLoader('renderer'),
viteResolve({
'virtual:i18n': i18nImporter(),
Expand Down Expand Up @@ -165,7 +168,7 @@ export default defineConfig({
build: {
...commonConfig.build,
minify: true,
cssMinify: true,
cssMinify: 'lightningcss',
},
};
}),
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@
"@eslint/js": "9.17.0",
"@playwright/test": "1.49.1",
"@stylistic/eslint-plugin-js": "2.12.1",
"@swc/core": "1.10.1",
"@total-typescript/ts-reset": "0.6.1",
"@types/color": "4.2.0",
"@types/electron-localshortcut": "3.1.3",
Expand All @@ -311,6 +312,7 @@
"eslint-plugin-import": "2.31.0",
"eslint-plugin-prettier": "5.2.1",
"glob": "11.0.0",
"lightningcss": "1.28.2",
"node-gyp": "11.0.0",
"playwright": "1.49.1",
"rollup": "4.28.1",
Expand Down
Loading

0 comments on commit ae3a289

Please sign in to comment.