mathjs
mathjs copied to clipboard
CommonJS or AMD dependencies can cause optimization bailouts seededRNG.js
"mathjs":` "^9.4.3",
Angular CLI: 12.1.1
Node: 16.4.0 (Unsupported)
Package Manager: npm 7.19.1
OS: win32 x64
Angular: 12.1.1
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, localize, material, material-moment-adapter
... platform-browser, platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1201.1
@angular-devkit/build-angular 12.1.1
@angular-devkit/core 12.1.1
@angular-devkit/schematics 12.1.1
@angular/flex-layout 12.0.0-beta.34
@schematics/angular 12.1.1
rxjs 6.6.7
typescript 4.3.4
ng build --configuration production
Warning: E:\Angular\VReport\node_modules\mathjs\lib\esm\function\probability\util\seededRNG.js depends on 'seedrandom'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies
Warning: initial exceeded maximum budget. Budget 500.00 kB was not met by 1.32 MB with a total of 1.81 MB.
Hey Toso! I have no experience with Angular, but I'm assuming this warning is about seedrandom being a CommonJS module. I'm afraid this is an upstream problem, see #72 on seedrandom. Unless we want to maintain our own fork of seedrandom (and I don't think we do), there doesn't seem to be any simple way to fix this. Sorry to disappoint you.
Hi all any news of this ?
I try to optimise import and as suggesion use:
import { create, detDependencies, evaluateDependencies, lusolveDependencies, sumDependencies } from 'mathjs';
const {det, evaluate, lusolve, sum } = create({
detDependencies, evaluateDependencies, lusolveDependencies, sumDependencies
})
But I have this but not use seededRNG.js
Warning: E:\Angular\VReport\node_modules\mathjs\lib\esm\function\probability\util\seededRNG.js depends on 'seedrandom'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies
Latest version of mathjs and angular
"mathjs": "^10.1.0",
No news.
In https://github.com/davidbau/seedrandom/issues/72#issuecomment-750472919 I see there is a forked esm version. We could have a look at that.
Anyone interested in looking in to this?
@josdejong Ok thanks. Or i don't know it is possible to not use or not include in dependance. Personaly i don't use
Hi, same issue with Angular 15+
Warning: /home/portfolio-
projects/node_modules/mathjs/lib/esm/core/create.js depends on 'typed-function'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies
Warning: /home/portfolio-projects/node_modules/mathjs/lib/esm/function/probability/util/seededRNG.js depends on 'seedrandom'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies
Warning: /home/portfolio-projects/node_modules/mathjs/lib/esm/function/relational/compareNatural.js depends on 'javascript-natural-sort'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies
Warning: /home/portfolio-projects/node_modules/mathjs/lib/esm/type/complex/Complex.js depends on 'complex.js'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies
Warning: /home/portfolio-projects/node_modules/mathjs/lib/esm/type/fraction/Fraction.js depends on 'fraction.js'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies
Warning: /home/portfolio-projects/node_modules/mathjs/lib/esm/utils/latex.js depends on 'escape-latex'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies
I just tried to use mathjs in a small project and once I tried to run my code, the compiler warned me the same message. There are upstream dependencies packaged with CommonJS inside mathjs, The thing is that Angular detects those modules as they may obstacle minifying and optimization., thus impacting on performance and bundle size. I have no problems with using it right now, but I'm concerned about using in real world projects, where performance/bundle size may be critical. is this issue open by any chance? Will it be solved in the near future? Thanks in advance.
Thanks for your inputs Rob. I think the problem is clear.
is this issue open by any chance? Will it be solved in the near future?
The issue is still open, and marked as "help needed". It will be solved as soon as someone provides a PR fixing it. Help would be welcome.