stacktrace.js
stacktrace.js copied to clipboard
Angular 10 build warning - CommonJS or AMD dependencies
Current Behavior
When using stacktrace-js in an Angular 10 project, the build process now displays the following errors:
WARNING in ...\Services\error-handler.service.ts depends on 'stacktrace-js'. CommonJS or AMD dependencies can cause optimization bailouts. For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies
WARNING in ...\node_modules\stacktrace-js\stacktrace.js depends on 'error-stack-parser'. CommonJS or AMD dependencies can cause optimization bailouts. For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies
WARNING in ...\node_modules\stacktrace-js\stacktrace.js depends on 'stacktrace-gps'. CommonJS or AMD dependencies can cause optimization bailouts. For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies
WARNING in ...\node_modules\stacktrace-js\stacktrace.js depends on 'stack-generator'. CommonJS or AMD dependencies can cause optimization bailouts. For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies
Steps to Reproduce (for bugs)
Import stacktrace-js like this in an Angular 10 project typescript file (e.g. service)
import * as StackTrace from "stacktrace-js";
Your Environment
- stacktrace.js version: 2.0.2
to supress this warning you could add an entry in your angular.json at path "projects/XXX/architect/build/options/allowedCommonJsDependencies"
"allowedCommonJsDependencies": [
"stacktrace-js",
"error-stack-parser",
"stacktrace-gps",
"stack-generator"
]
@der-raist Thanks for the workaround. I saw that in the Angular docs in the links about the warning. I'm hoping that this package gets updated to ECMAScript modules.