I am using an external javascript library in my angular 8 app containing a require statement at the first place.
require('dependency')
However I included the dependency and the other library in the angular.json scripts-section.
The problem is that the require-method does not get called or is not known:
someLibrary.js:1 Uncaught ReferenceError: require is not defined
So how can I solve this issue in context of angular.
Here are my compiler options too:
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"module": "commonjs", // <-- value: "es2015" also not solves the issue
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"importHelpers": true,
"target": "es2015",
"typeRoots": ["node_modules/@types"],
"lib": ["es2018", "dom"]
}
Does anyone know how to fix this? does this has something to do with this here: https://stackoverflow.com/a/950146/4457758