From ce8fd685f32a2c1f83e58a369d7c746e69b64c0d Mon Sep 17 00:00:00 2001 From: Ren Amamiya <123083837+reyamir@users.noreply.github.com> Date: Mon, 24 Apr 2023 13:51:59 +0700 Subject: [PATCH] update config --- .eslintrc | 3 ++- package.json | 1 + pnpm-lock.yaml | 11 +++++++++++ vite.config.ts | 16 +++++++++++++--- 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/.eslintrc b/.eslintrc index 0e9ed689..0ada66f1 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,6 +1,6 @@ { "parser": "@typescript-eslint/parser", - "plugins": ["@typescript-eslint"], + "plugins": ["@typescript-eslint", "react-refresh"], "extends": [ "plugin:react/recommended", "plugin:react/jsx-runtime", @@ -11,6 +11,7 @@ "rules": { "@typescript-eslint/no-unused-vars": "error", "@typescript-eslint/no-explicit-any": "warn", + "react-refresh/only-export-components": "error", "react/no-unknown-property": ["error", { "ignore": ["fetchpriority"] }] }, "ignorePatterns": ["dist", "**/*.js", "**/*.json", "node_modules"] diff --git a/package.json b/package.json index 845503db..164b12c6 100644 --- a/package.json +++ b/package.json @@ -58,6 +58,7 @@ "eslint-config-prettier": "^8.8.0", "eslint-plugin-react": "^7.32.2", "eslint-plugin-react-hooks": "^4.6.0", + "eslint-plugin-react-refresh": "^0.3.4", "husky": "^8.0.3", "lint-staged": "^13.2.1", "postcss": "^8.4.23", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index dfd693bd..0d856b90 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -29,6 +29,7 @@ specifiers: eslint-config-prettier: ^8.8.0 eslint-plugin-react: ^7.32.2 eslint-plugin-react-hooks: ^4.6.0 + eslint-plugin-react-refresh: ^0.3.4 husky: ^8.0.3 iconoir-react: ^6.6.0 jotai: ^2.0.4 @@ -102,6 +103,7 @@ devDependencies: eslint-config-prettier: 8.8.0_eslint@8.39.0 eslint-plugin-react: 7.32.2_eslint@8.39.0 eslint-plugin-react-hooks: 4.6.0_eslint@8.39.0 + eslint-plugin-react-refresh: 0.3.4_eslint@8.39.0 husky: 8.0.3 lint-staged: 13.2.1 postcss: 8.4.23 @@ -2447,6 +2449,15 @@ packages: eslint: 8.39.0 dev: true + /eslint-plugin-react-refresh/0.3.4_eslint@8.39.0: + resolution: + { integrity: sha512-E0ViBglxSQAERBp6eTj5fPgtCRtDonnbCFiVQBhf4Dto2blJRxg1dFUMdMh7N6ljTI4UwPhHwYDQ3Dyo4m6bwA== } + peerDependencies: + eslint: '>=7' + dependencies: + eslint: 8.39.0 + dev: true + /eslint-plugin-react/7.32.2_eslint@8.39.0: resolution: { integrity: sha512-t2fBMa+XzonrrNkyVirzKlvn5RXzzPwRHtMvLAtVZrt8oxgnTQaYbU6SXTOO1mwQgp1y5+toMSKInnzGr0Knqg== } diff --git a/vite.config.ts b/vite.config.ts index 9f6f474b..a0b84651 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -5,6 +5,19 @@ import topLevelAwait from 'vite-plugin-top-level-await'; import viteTsconfigPaths from 'vite-tsconfig-paths'; export default defineConfig({ + clearScreen: false, + server: { + strictPort: true, + }, + envPrefix: ['VITE_', 'TAURI_'], + build: { + // Tauri uses Chromium on Windows and WebKit on macOS and Linux + target: process.env.TAURI_PLATFORM == 'windows' ? 'chrome105' : 'safari13', + // don't minify for debug builds + minify: !process.env.TAURI_DEBUG ? 'esbuild' : false, + // produce sourcemaps for debug builds + sourcemap: !!process.env.TAURI_DEBUG, + }, plugins: [ react(), ssr({ prerender: true }), @@ -14,7 +27,4 @@ export default defineConfig({ promiseImportName: (i) => `__tla_${i}`, }), ], - define: { - global: 'window', - }, });