Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ReferenceError: _rollupMoment__default is not defined

Started having this error in the browser after upgrading my site to Angular 9.1.0. I only get the error after creating the prod bundles, not when I serve the app in my local dev environment. Here's the entire error message ....

    at Module.zUnb (main-es2015.9c35e84416c2df24da56.js:1)
    at l (runtime-es2015.c9afb3256f2870e161de.js:1)
    at Object.0 (main-es2015.9c35e84416c2df24da56.js:1)
    at l (runtime-es2015.c9afb3256f2870e161de.js:1)
    at t (runtime-es2015.c9afb3256f2870e161de.js:1)
    at Array.r [as push] (runtime-es2015.c9afb3256f2870e161de.js:1)
    at main-es2015.9c35e84416c2df24da56.js:1

Any idea how I could fix this?

like image 353
John Avatar asked Mar 23 '26 13:03

John


1 Answers

Had the same issue. Seems to stem from using 0.901.0 of @angular-devkit/build-angular.

Suggestion in link mentioned above is to either

1) downgrade to @angular-devkit/[email protected].

2) my perference, add the following to polyfills.ts to fix the undefined problem

window['_rollupMoment__default'] = null;
window['dragulaExpt__default'] = null;

Note the issue, as far as I have seen, is with Moment and dragula.

If you want to verify the cause of the problem which, for me, only happens on a production angular build (ng build --prod) it is difficult to see when optimizations have happened as part of the build (minification etc). To avoid that run the following to allow for your local testing:

ng build --prod --optimization=false
like image 184
obaylis Avatar answered Mar 25 '26 03:03

obaylis



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!