feat: add Vite config and TypeScript settings for web build

This commit is contained in:
2026-04-27 08:24:55 +09:00
parent 57d4a9bf17
commit 7e9bc4bfdd
6 changed files with 79 additions and 9 deletions

1
package-lock.json generated
View File

@@ -14,6 +14,7 @@
"zustand": "^5.0.12"
},
"devDependencies": {
"@emotion/babel-plugin": "^11.13.5",
"@types/node": "^22.7.0",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",

View File

@@ -16,6 +16,7 @@
"zustand": "^5.0.12"
},
"devDependencies": {
"@emotion/babel-plugin": "^11.13.5",
"@types/node": "^22.7.0",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",

View File

@@ -1,23 +1,26 @@
{
"compilerOptions": {
"target": "ESNext",
"lib": ["ESNext", "DOM"],
"jsx": "react-jsx",
"jsxImportSource": "@emotion/react",
"target": "ES2022",
"lib": ["ES2022", "DOM", "DOM.Iterable"],
"useDefineForClassFields": true,
"module": "ESNext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
"jsxImportSource": "@emotion/react",
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"skipLibCheck": true,
"ignoreDeprecations": "6.0",
"types": ["webpack-env"],
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
"include": ["src", "vite-env.d.ts"],
"references": [{ "path": "./tsconfig.node.json" }]
}

12
tsconfig.node.json Normal file
View File

@@ -0,0 +1,12 @@
{
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true,
"strict": true,
"types": ["node"]
},
"include": ["vite.config.ts"]
}

14
vite-env.d.ts vendored Normal file
View File

@@ -0,0 +1,14 @@
/// <reference types="vite/client" />
declare const __APP_VERSION__: string;
interface ImportMetaEnv {
readonly VITE_PUBLIC_URL: string;
readonly VITE_AD_ADAPTER: string;
readonly VITE_GA_MEASUREMENT_ID: string;
readonly VITE_ENABLE_PUSH: string;
}
interface ImportMeta {
readonly env: ImportMetaEnv;
}

39
vite.config.ts Normal file
View File

@@ -0,0 +1,39 @@
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
export default defineConfig({
plugins: [
react({
jsxImportSource: '@emotion/react',
babel: {
plugins: ['@emotion/babel-plugin'],
},
}),
],
base: './',
resolve: {
alias: {
'@': '/src',
},
},
server: {
port: 5173,
strictPort: false,
open: true,
},
build: {
outDir: 'dist',
sourcemap: true,
rollupOptions: {
output: {
manualChunks: {
'react-vendor': ['react', 'react-dom'],
'state': ['zustand'],
},
},
},
},
define: {
__APP_VERSION__: JSON.stringify(process.env.npm_package_version),
},
});