Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 6085

TypeScript not working if parent folder contains "node_modules"

$
0
0

I'm trying to build this project in "/tmp/path/to/node_modules/source":

Note that this path "/tmp/path/to/node_modules/source" is not changable for finding the root cause of the error.

https://github.com/kbysiec/vite-vanilla-ts-lib-starter

Here is the git clone:

mkdir -p /tmp/path/to/node_modules/sourcecd /tmp/path/to/node_modules/sourcegit clone https://github.com/kbysiec/vite-vanilla-ts-lib-starter.gitcd vite-vanilla-ts-lib-starternpm i

Now, run build:

npm run build

Here is the error:

> vite-vanilla-ts-lib-starter@0.0.2 build> rimraf build/**/* && tsc && vite build && dts-bundle-generator --config ./dts-bundle-generator.config.ts && copyfiles ./package.json buildThe CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.vite v5.0.12 building for production...✓ 3 modules transformed.build/dist/style.css                        0.17 kB │ gzip: 0.15 kBbuild/dist/vite-vanilla-ts-lib-starter.mjs  0.05 kB │ gzip: 0.07 kBbuild/dist/style.css                        0.17 kB │ gzip: 0.15 kBbuild/dist/vite-vanilla-ts-lib-starter.cjs  0.11 kB │ gzip: 0.13 kBbuild/dist/style.css                            0.17 kB │ gzip: 0.15 kBbuild/dist/vite-vanilla-ts-lib-starter.iife.js  0.16 kB │ gzip: 0.15 kB✓ built in 82msCompiling input files...WARNING: It seems that some files in the compilation still are not declaration files.For more information see https://github.com/timocov/dts-bundle-generator/issues/53.If you think this is a mistake, feel free to open new issue or just ignore this warning.  /tmp/path/to/node_modules/source/vite-vanilla-ts-lib-starter/src/sum.tsProcessing src/index.tsWriting src/index.ts -> build/dist/index.d.tsChecking generated files...build/dist/index.d.ts(3,21): error TS2307: Cannot find module './sum' or its corresponding type declarations.Error: Compiled with errors

Here is the tsconfig.json:

https://github.com/kbysiec/vite-vanilla-ts-lib-starter/blob/master/tsconfig.json

{"compilerOptions": {"rootDir": ".","paths": {"@/*": ["./src/*"],"@@/*": ["./*"],    },"target": "ESNext","useDefineForClassFields": true,"module": "ESNext","lib": ["ESNext", "DOM"],"moduleResolution": "Node","strict": true,"sourceMap": true,"resolveJsonModule": true,"esModuleInterop": true,"noEmit": true,"noUnusedLocals": true,"noUnusedParameters": true,"noImplicitReturns": true,"forceConsistentCasingInFileNames": true,"types": ["vite/client", "node"],  },"include": ["src"],"exclude": ["**/*.test.ts", "node_modules", "test/**", ".history/**"],}

How to configure the "tsconfig.json" for making the "npm run build" work in this case?


Viewing all articles
Browse latest Browse all 6085

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>