From 012f3c9e6f5c1ab637d9bb13b9e209796ced3323 Mon Sep 17 00:00:00 2001 From: Edoardo Dusi Date: Mon, 16 Dec 2024 15:54:50 +0100 Subject: [PATCH] fix: resolve path aliases in d.ts build files --- package.json | 3 ++- pnpm-lock.yaml | 22 ++++++++++++++++++++++ vite.config.ts | 5 +++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index d6fe9989..07eb5003 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ ], "scripts": { "dev": "vite build --watch", - "build": "vite build && tsc --project tsconfig.json", + "build": "vite build && tsc --project tsconfig.json && resolve-tspaths --ext d.ts", "test": "pnpm run test:unit:ci && pnpm run test:e2e", "test:unit": "vitest", "test:unit:ci": "vitest run", @@ -79,6 +79,7 @@ "eslint-plugin-jest": "^28.9.0", "react": "^18.3.1", "react-dom": "^18.3.1", + "resolve-tspaths": "^0.8.23", "rollup-plugin-preserve-directives": "^0.4.0", "simple-git-hooks": "^2.11.1", "start-server-and-test": "^2.0.8", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 601eaaed..4ed78ee5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -69,6 +69,9 @@ importers: react-dom: specifier: ^18.3.1 version: 18.3.1(react@18.3.1) + resolve-tspaths: + specifier: ^0.8.23 + version: 0.8.23(typescript@5.6.3) rollup-plugin-preserve-directives: specifier: ^0.4.0 version: 0.4.0(rollup@4.27.2) @@ -2352,6 +2355,10 @@ packages: resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} engines: {node: '>= 0.8'} + commander@12.1.0: + resolution: {integrity: sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==} + engines: {node: '>=18'} + commander@6.2.1: resolution: {integrity: sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==} engines: {node: '>= 6'} @@ -4476,6 +4483,12 @@ packages: resolve-pkg-maps@1.0.0: resolution: {integrity: sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==} + resolve-tspaths@0.8.23: + resolution: {integrity: sha512-VMZPjXnYLHnNHXOmJ9Unkkls08zDc+0LSBUo8Rp+SKzRt8rfD9dMpBudQJ5PNG8Szex/fnwdNKzd7rqipIH/zg==} + hasBin: true + peerDependencies: + typescript: '>=3.0.3' + resolve.exports@2.0.2: resolution: {integrity: sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==} engines: {node: '>=10'} @@ -7706,6 +7719,8 @@ snapshots: dependencies: delayed-stream: 1.0.0 + commander@12.1.0: {} + commander@6.2.1: {} comment-parser@1.4.1: {} @@ -10520,6 +10535,13 @@ snapshots: resolve-pkg-maps@1.0.0: {} + resolve-tspaths@0.8.23(typescript@5.6.3): + dependencies: + ansi-colors: 4.1.3 + commander: 12.1.0 + fast-glob: 3.3.2 + typescript: 5.6.3 + resolve.exports@2.0.2: optional: true diff --git a/vite.config.ts b/vite.config.ts index 326df48d..e3b025f8 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -25,6 +25,11 @@ export default defineConfig({ }, }, }, + resolve: { + alias: { + '@': path.resolve(__dirname, 'src'), + }, + }, test: { globals: true, include: ['./src/__tests__/**/*'],