From 8a850fbe6b5e7450a97d380565dbdfaea96626d7 Mon Sep 17 00:00:00 2001 From: tamaina Date: Sat, 23 Apr 2022 04:04:26 +0900 Subject: [PATCH] :v: --- packages/backend/src/server/web/boot.js | 2 -- packages/client/@types/env.d.ts | 9 +++++++++ packages/client/package.json | 2 +- packages/client/vite.config.ts | 6 +++--- 4 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 packages/client/@types/env.d.ts diff --git a/packages/backend/src/server/web/boot.js b/packages/backend/src/server/web/boot.js index 01a27595ee..43f8553abd 100644 --- a/packages/backend/src/server/web/boot.js +++ b/packages/backend/src/server/web/boot.js @@ -60,8 +60,6 @@ const script = document.createElement('script'); script.setAttribute('src', `/assets/${CLIENT_ENTRY}${salt}`); - script.setAttribute('async', 'true'); - script.setAttribute('defer', 'true'); script.setAttribute('type', 'module'); script.addEventListener('error', async () => { await checkUpdate(); diff --git a/packages/client/@types/env.d.ts b/packages/client/@types/env.d.ts new file mode 100644 index 0000000000..28ae7076ee --- /dev/null +++ b/packages/client/@types/env.d.ts @@ -0,0 +1,9 @@ +/// + +interface ImportMetaEnv { + readonly VITE_APP_TITLE: string +} + +interface ImportMeta { + readonly env: ImportMetaEnv +} diff --git a/packages/client/package.json b/packages/client/package.json index 62f6867c71..fe1e55befc 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,7 +1,7 @@ { "private": true, "scripts": { - "watch": "vite build --watch", + "watch": "vite build --watch --mode development", "build": "vite build", "lint": "eslint --quiet 'src/**/*.{ts,vue}'" }, diff --git a/packages/client/vite.config.ts b/packages/client/vite.config.ts index 1df520bae5..71ba249ec8 100644 --- a/packages/client/vite.config.ts +++ b/packages/client/vite.config.ts @@ -3,13 +3,13 @@ import pluginVue from '@vitejs/plugin-vue'; import pluginJson5 from './vite.json5'; import { defineConfig } from 'vite'; +import locales from '../../locales'; +import meta from '../../package.json'; + const extensions = ['.ts', '.tsx', '.js', '.jsx', '.mjs', '.json', '.json5', '.svg', '.sass', '.scss', '.css', '.vue']; const isProduction = process.env.NODE_ENV === 'production'; -const locales = require('../../locales'); -const meta = require('../../package.json'); - export default defineConfig(({ command, mode }) => { fs.mkdirSync(__dirname + '/../../built', { recursive: true }); fs.writeFileSync(__dirname + '/../../built/meta.json', JSON.stringify({ version: meta.version }), 'utf-8');