diff --git a/package.json b/package.json index f563806..77bb680 100644 --- a/package.json +++ b/package.json @@ -81,6 +81,7 @@ "typescript-eslint": "^8.18.1", "valtio": "^2.1.2", "vite": "^6.0.4", + "vite-tsconfig-paths": "^5.1.4", "vitest": "^2.1.8" }, "peerDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c45843a..68466c4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -80,6 +80,9 @@ importers: vite: specifier: ^6.0.4 version: 6.0.4(@types/node@22.10.2) + vite-tsconfig-paths: + specifier: ^5.1.4 + version: 5.1.4(typescript@5.7.2)(vite@6.0.4(@types/node@22.10.2)) vitest: specifier: ^2.1.8 version: 2.1.8(@types/node@22.10.2)(happy-dom@15.11.7) @@ -1161,6 +1164,9 @@ packages: resolution: {integrity: sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==} engines: {node: '>= 0.4'} + globrex@0.1.2: + resolution: {integrity: sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==} + gopd@1.2.0: resolution: {integrity: sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==} engines: {node: '>= 0.4'} @@ -1757,6 +1763,16 @@ packages: ts-expect@1.3.0: resolution: {integrity: sha512-e4g0EJtAjk64xgnFPD6kTBUtpnMVzDrMb12N1YZV0VvSlhnVT3SGxiYTLdGy8Q5cYHOIC/FAHmZ10eGrAguicQ==} + tsconfck@3.1.4: + resolution: {integrity: sha512-kdqWFGVJqe+KGYvlSO9NIaWn9jT1Ny4oKVzAJsKii5eoE9snzTJzL4+MMVOMn+fikWGFmKEylcXL710V/kIPJQ==} + engines: {node: ^18 || >=20} + hasBin: true + peerDependencies: + typescript: ^5.0.0 + peerDependenciesMeta: + typescript: + optional: true + tsconfig-paths@3.15.0: resolution: {integrity: sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==} @@ -1819,6 +1835,14 @@ packages: engines: {node: ^18.0.0 || >=20.0.0} hasBin: true + vite-tsconfig-paths@5.1.4: + resolution: {integrity: sha512-cYj0LRuLV2c2sMqhqhGpaO3LretdtMn/BVX4cPLanIZuwwrkVl+lK84E/miEXkCHWXuq65rhNN4rXsBcOB3S4w==} + peerDependencies: + vite: '*' + peerDependenciesMeta: + vite: + optional: true + vite@5.4.11: resolution: {integrity: sha512-c7jFQRklXua0mTzneGW9QVyxFjUgwcihC4bXEtujIo2ouWCe1Ajt/amn2PCxYnhYfd5k09JX3SB7OYWFKYqj8Q==} engines: {node: ^18.0.0 || >=20.0.0} @@ -3094,6 +3118,8 @@ snapshots: define-properties: 1.2.1 gopd: 1.2.0 + globrex@0.1.2: {} + gopd@1.2.0: {} graceful-fs@4.2.11: {} @@ -3707,6 +3733,10 @@ snapshots: ts-expect@1.3.0: {} + tsconfck@3.1.4(typescript@5.7.2): + optionalDependencies: + typescript: 5.7.2 + tsconfig-paths@3.15.0: dependencies: '@types/json5': 0.0.29 @@ -3801,6 +3831,17 @@ snapshots: - supports-color - terser + vite-tsconfig-paths@5.1.4(typescript@5.7.2)(vite@6.0.4(@types/node@22.10.2)): + dependencies: + debug: 4.4.0 + globrex: 0.1.2 + tsconfck: 3.1.4(typescript@5.7.2) + optionalDependencies: + vite: 6.0.4(@types/node@22.10.2) + transitivePeerDependencies: + - supports-color + - typescript + vite@5.4.11(@types/node@22.10.2): dependencies: esbuild: 0.21.5 diff --git a/vite.config.ts b/vite.config.ts index a2f0d88..88fd1f3 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -2,17 +2,18 @@ import { resolve } from 'node:path'; import { defineConfig } from 'vite'; +import tsconfigPaths from 'vite-tsconfig-paths'; const { DIR, PORT = '8080' } = process.env; export default defineConfig(({ mode }) => { if (mode === 'test') { return { - resolve: { alias: { 'jotai-valtio': resolve('src') } }, test: { environment: 'happy-dom', setupFiles: ['./tests/vitest-setup.ts'], }, + plugins: [tsconfigPaths()], }; } if (!DIR) { @@ -21,6 +22,6 @@ export default defineConfig(({ mode }) => { return { root: resolve('examples', DIR), server: { port: Number(PORT) }, - resolve: { alias: { 'jotai-valtio': resolve('src') } }, + plugins: [tsconfigPaths()], }; });