'External library not found in typescript build
Good morning everyone, while developing a library I needed to install a third party library to do the job. I tried to modify my tsconfig.json file but it wasn't enough, you can see below the configuration I set (some fields were added as I searched the net):
{
"compilerOptions": {
/* Visit https://aka.ms/tsconfig.json to read more about this file */
/* Language and Environment */
"target": "ES2021",
"lib": ["DOM", "ES2021"],
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
/* Modules */
"module": "ES2020",
"rootDir": "./",
"moduleResolution": "node",
"baseUrl": ".",
/* JavaScript Support */
"allowJs": true,
"maxNodeModuleJsDepth": 1,
/* Emit */
"outDir": "./dist",
/* Interop Constraints */
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
/* Type Checking */
"strict": true,
"noImplicitAny": false,
"skipLibCheck": true,
},
"include":[
"./node_modules/html2canvas"
]
}
However, when I get to the part where I have to use the library during the build phase, it gives me this error in the console:
Uncaught (in promise) ReferenceError: html2canvas is not defined
could you tell me what is solvable? there are other questions about SO but none of them solve my problem.
Would anyone be kind enough to tell me how to fix and where am I wrong?
Thank you so much.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
