Moment-timezone: Module parse failed:moment-timezone/data/packed/latest.json Line 2: Unexpected token :

Created on 24 Aug 2015  路  3Comments  路  Source: moment/moment-timezone

Simply doing this:

var moment = require('moment-timezone');

It causes me this in webpack:

ERROR in ./~/moment-timezone/data/packed/latest.json
Module parse failed: /Users/ben/pro/qbvault/node_modules/moment-timezone/data/packed/latest.json Line 2: Unexpected token :
You may need an appropriate loader to handle this file type.
| {
|   "version": "2015d",
|   "zones": [
|       "Africa/Abidjan|LMT GMT|g.8 0|01|-2ldXH.Q",
 @ ./~/moment-timezone/index.js 2:15-51

Most helpful comment

For completeness in case someone stumbles on this.

Here is how to solve it: http://stackoverflow.com/questions/29548386/how-should-i-use-moment-timezone-with-webpack

All 3 comments

My stupid error, forgot to import the json-loader to my new project.

Sorry, It has been a long day... :disappointed:

For completeness in case someone stumbles on this.

Here is how to solve it: http://stackoverflow.com/questions/29548386/how-should-i-use-moment-timezone-with-webpack

My solution:

change timezone/data/packed/latest.json
moment.tz.load(require('./data/packed/latest.json'));

to
moment.tz.load(require('!json!./data/packed/latest.json'));

Was this page helpful?
0 / 5 - 0 ratings

Related issues

palindrom615 picture palindrom615  路  4Comments

dharapvj picture dharapvj  路  4Comments

rjpedrosa picture rjpedrosa  路  5Comments

edu2004eu picture edu2004eu  路  6Comments

ghost picture ghost  路  4Comments