Numeral-js: Module (v2.0.0) doesn't work with webpack

Created on 7 Dec 2016  Â·  1Comment  Â·  Source: adamwdraper/Numeral-js

And it's due to this expression:

var numeral = typeof window !== 'undefined' ? this.numeral : require('../numeral')

typeof window !== 'undefined' returns true but there is no this.numeral (as there should not be any because WebPack like browserify bases on module systems - not global window object).

To make it work it needs a little change like:

typeof window !== 'undefined' && window.numeral ? window.numeral…

Or change this condition to check for module systems?

Should look somehow like:

(typeof module !== 'undefined' && module.exports) || (typeof define === 'function' && define.amd) ? require('../numeral') : this.numeral

Most helpful comment

Is fixed with 2.0.1. Thanks

>All comments

Is fixed with 2.0.1. Thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kinguru picture kinguru  Â·  6Comments

jonathanbergson picture jonathanbergson  Â·  6Comments

tab00 picture tab00  Â·  8Comments

Eric24 picture Eric24  Â·  8Comments

amirtgm picture amirtgm  Â·  6Comments