Numeral-js: Using 2.x with locales and webpack

Created on 27 Dec 2016  路  4Comments  路  Source: adamwdraper/Numeral-js

Is anyone successfully using the 2.x release with locales and webpack?

The following results in a Cannot read property 'delimiters' of undefined error:

import numeral from "numeral"
numeral.locale("nl-nl")

And when I try this

import numeral from "numeral"
import numeralnl from "numeral/locales/nl-nl"
numeral.register("locale", "nl-nl", numeralnl)
numeral.locale("nl-nl")

It throws the Uncaught TypeError: nl-nl locale already registered error.

Most helpful comment

I've managed to make it work like this:

import numeral from "numeral"
import numeralen from "numeral/locales/en-gb"

numeral.locale("en-gb")

I was having the Cannot read property 'delimiters' of undefined issue as well.

Running on:

"webpack": "^1.13.2"
"numeral": "^2.0.4",

All 4 comments

With 1.5.x this was working properly:

import numeral from "numeral"
import numeralnl from "numeral/languages/nl-nl"
numeral.language("nl-nl", numeralnl)
numeral.language("nl-nl")

I've managed to make it work like this:

import numeral from "numeral"
import numeralen from "numeral/locales/en-gb"

numeral.locale("en-gb")

I was having the Cannot read property 'delimiters' of undefined issue as well.

Running on:

"webpack": "^1.13.2"
"numeral": "^2.0.4",

Thanks, that works!

In Webpack 4 (Angular 5) I had to use:

import * as numeral from "numeral";
const numeralen = require("numeral/locales/de-ch");
numeral.locale("de-ch");

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tab00 picture tab00  路  8Comments

tony-kerz picture tony-kerz  路  6Comments

chumager picture chumager  路  3Comments

fabien-h picture fabien-h  路  9Comments

MisterGoodcat picture MisterGoodcat  路  3Comments