moment / moment-timezone

Timezone support for moment.js
momentjs.com/timezone
MIT License
3.82k stars 835 forks source link

SyntaxError: E:\landlord-front-end\node_modules\.pnpm\moment-timezone@0.5.45\node_modules\moment-timezone\data\packed\latest.json: Missing semicolon. #1106

Closed zchfeng closed 3 months ago

zchfeng commented 3 months ago

SyntaxError: E:\landlord-front-end\node_modules.pnpm\moment-timezone@0.5.41\node_modules\moment-timezone\data\packed\latest.json: Missing semicolon. (2:10) 1 | {

2 | "version": "2022g", | ^ 3 | "zones": [ 4 | "Africa/Abidjan|LMT GMT|g.8 0|01|-2ldXH.Q|48e5", 5 | "Africa/Nairobi|LMT +0230 EAT +0245|-2r.g -2u -30 -2J|012132|-2ua2r.g N6nV.g 3Fbu h1cu dzbJ|47e5",

When I introduced the use of JSON loader, ./node_modules/.pnpm/moment-timezone@0.5.41/node_modules/moment-timezone/data/packed/latest.json Module parse failed: Unexpected token m in JSON at position 0 while parsing near 'module.exports={"ver...' File was processed with these loaders:

gilmoreorless commented 3 months ago

The packed JSON data in this library is definitely valid JSON; otherwise the core functionality would fail. Also, the syntax error doesn't even make sense to me, because the JSON spec doesn't involve semicolons at all.

If a separate library is having trouble reading the file, then that's out of scope for this project and issue tracker. (As a side note, json-loader has a message in its README saying it hasn't been needed since webpack v2, and its repository was archived nearly 6 years ago).