You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've added the following object to the plugins array in webpack.config:
// `currentYear` is obviously defined above:
// const currentYear = new Date().getFullYear();
new MomentTimezoneDataPlugin({
startYear: currentYear - 1,
endYear: currentYear + 1,
matchCountries: ['US', 'CA'],
}),
When I try to start my project, I get the following error stack:
TypeError: Cannot read property 'length' of undefined
at findStartAndEndIndex (.../node_modules/moment-timezone/moment-timezone-utils.js:249:18)
at filterYears (.../node_modules/moment-timezone/moment-timezone-utils.js:282:16)
at Function.filterLinkPack (.../node_modules/moment-timezone/moment-timezone-utils.js:308:21)
at filterData (.../node_modules/moment-timezone-data-webpack-plugin/src/index.js:100:34)
at .../node_modules/moment-timezone-data-webpack-plugin/src/index.js:190:34
at .../node_modules/webpack/lib/NormalModuleReplacementPlugin.js:36:8
at AsyncSeriesWaterfallHook.eval [as callAsync] (eval at create (.../node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:19:16)
at .../node_modules/webpack/lib/NormalModuleFactory.js:138:29
at .../node_modules/webpack/lib/NormalModuleFactory.js:346:9
The faulty line is endI = untils.length + 1, so I tried printing the faulty source that's missing untils and apparently it's this one, which contains only the name key:
{ name: 'America/Indiana/Indianapolis' }
Couldn't find any previous occurrence to this error, so I hope you can help.
Thanks a lot!
The text was updated successfully, but these errors were encountered:
Ooh yep, looks like a bug in this plugin, passing the wrong data into moment-timezone. When I try your configuration I get the same failure, but if I try using matchZones: 'America/Indiana/Indianapolis' instead of matchCountries, it works fine.
The bug was a hidden assumption in my code that the list of zones for each country would not contain any links to other zones, because that's how the IANA source files define them. This turned out not to be true: moment/moment-timezone#835
I've added a workaround and released version 1.3.0.
I've added the following object to the
plugins
array inwebpack.config
:When I try to start my project, I get the following error stack:
The faulty line is
endI = untils.length + 1
, so I tried printing the faultysource
that's missinguntils
and apparently it's this one, which contains only thename
key:Couldn't find any previous occurrence to this error, so I hope you can help.
Thanks a lot!
The text was updated successfully, but these errors were encountered: