RC0: Uncaught ReferenceError: output is not defined


#1

I am trying to migrate my Ionic 2 beta 11 project to RC0. Now finally my project passes the ngc phase but now I get an error in the console: Uncaught ReferenceError: output is not defined

Looking at the location of the error it seems to be related to the DateJS package that I installed with npm. My guess is that with the new rollup build process something is behaving differently while minifying, because with beta 11 is worked just fine.

I am less familiar with the various build processes out there. What would be the best strategy to overcome this? Is there some setting that I should add to rollup somewhere? Should I instead use an already minified version of DateJS instead of the npm module (which does not contain a minified version as far as I can see). The latter seems ugly…

Thanks for your input.


#2

Even when I set the mangle to false in ./node_modules/@ionic/app-scripts/config/uglifyjs.config.js I still get the error. When I manually load (in index.html) minimized versions of the libraries (and don’t import them) it is working fine.

It also happens when importing the intl polyfill for Safari so I can use the date pipe (see this post on stackoverlow)

Then when I import as below I get: main.js:67085 Uncaught ReferenceError: IntlPolyfill is not defined

import 'intl';
import 'intl/locale-data/jsonp/en';

#3

Same issue here. Found anything out?


#4

From what I understand the problem lies with the combination of Rollup and non-ES6 modules because the tree-shaking works with ES6 modules only (as explained here).

So I ended just copying the Intl.complete.js from the npm package to my src/assets/js directory and then including it in a script-tag in my index.html.

Less fancy but it works.