rxaviers / globalize-webpack-plugin

Globalize.js webpack plugin
Other
33 stars 27 forks source link

Production issue with ar-SA-u-nu-latn #75

Open nikoskalogridis opened 7 years ago

nikoskalogridis commented 7 years ago

using an ar-SA locale but with the u-nu-latn customization with the following config:

...
new GlobalizePlugin({
      production: true,
      developmentLocale: 'el',
      supportedLocales: ['ar-SA', 'en', 'de', 'fr', 'el'],
      output: '/i18n/[locale].js'
    }),
...

then the following code has issues:

Globalize.locale('ar-SA-u-nu-latn');
_formatDateShort = Globalize.dateFormatter({skeleton: 'yMd'}); // this becomes undefined
_formatDateFull = Globalize.dateFormatter({date: 'full'}); // this becomes undefined
_formatDateWithDay = Globalize.dateFormatter({skeleton: 'yMEd'}); // this becomes undefined
_formatMinTextDay = Globalize.dateFormatter({skeleton: 'E'}); // this becomes undefined
_format12Hour = Globalize.dateFormatter({skeleton: 'hm'}); // this becomes undefined
_format24Hour = Globalize.dateFormatter({skeleton: 'Hm'}); // this becomes undefined
_formatTimePeriod = Globalize.dateFormatter({raw: 's'}); // this becomes undefined
_formatMonthDayPeriod = Globalize.dateFormatter({skeleton: 'MMMEd'}); // this becomes undefined
_formatDateMonth = Globalize.dateFormatter({skeleton: 'Md'}); // this becomes undefined
_formatDayDateMonth = Globalize.dateFormatter({skeleton: 'MEd'}); // this becomes undefined
_formatDay24Hour = Globalize.dateFormatter({skeleton: 'EHm'}); // this becomes undefined
_formatDateDate = Globalize.dateFormatter({skeleton: 'd'}); // this becomes undefined
_formatDateMonthYear = Globalize.dateFormatter({skeleton: 'yMMM'}); // this becomes undefined

I have tried to include in the webpack plugin supportedLocales the 'ar-SA-u-nu-latn' but then the build fails with:

Error: Cannot find module './main/ar-SA-u-nu-latn/ca-gregorian'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at cldrData (/home/user/projects/frontline/node_modules/cldr-data/index.js:55:10)
    at /home/user/projects/frontline/node_modules/globalize-webpack-plugin/util.js:19:14
    at Array.map (native)
    at cldr (/home/user/projects/frontline/node_modules/globalize-webpack-plugin/util.js:18:59)
    at Object.compileExtracts (/home/user/projects/frontline/node_modules/globalize-compiler/lib/compile-extracts.js:55:18)
    at GlobalizeCompilerHelper.compile (/home/user/projects/frontline/node_modules/globalize-webpack-plugin/GlobalizeCompilerHelper.js:63:33)
    at /home/user/projects/frontline/node_modules/globalize-webpack-plugin/ProductionModePlugin.js:235:51
    at RegExp.[Symbol.replace] (native)
    at RegExp.[Symbol.replace] (native)
    at String.replace (native)
    at /home/user/projects/frontline/node_modules/globalize-webpack-plugin/ProductionModePlugin.js:229:58
    at Array.forEach (native)
    at /home/user/projects/frontline/node_modules/globalize-webpack-plugin/ProductionModePlugin.js:227:63
    at Array.forEach (native)
    at Compilation.<anonymous> (/home/user/projects/frontline/node_modules/globalize-webpack-plugin/ProductionModePlugin.js:225:10)
    at Compilation.applyPlugins (/home/user/projects/frontline/node_modules/tapable/lib/Tapable.js:26:37)
    at Compilation.<anonymous> (/home/user/projects/frontline/node_modules/webpack/lib/Compilation.js:558:8)
    at Compilation.next (/home/user/projects/frontline/node_modules/tapable/lib/Tapable.js:67:11)
    at ExtractTextPlugin.<anonymous> (/home/user/projects/frontline/node_modules/extract-text-webpack-plugin/index.js:285:5)
    at /home/user/projects/frontline/node_modules/extract-text-webpack-plugin/node_modules/async/lib/async.js:52:16
    at done (/home/user/projects/frontline/node_modules/extract-text-webpack-plugin/node_modules/async/lib/async.js:246:17)
    at /home/user/projects/frontline/node_modules/extract-text-webpack-plugin/node_modules/async/lib/async.js:44:16
    at /home/user/projects/frontline/node_modules/extract-text-webpack-plugin/index.js:269:6
    at /home/user/projects/frontline/node_modules/extract-text-webpack-plugin/node_modules/async/lib/async.js:52:16
    at done (/home/user/projects/frontline/node_modules/extract-text-webpack-plugin/node_modules/async/lib/async.js:246:17)
    at /home/user/projects/frontline/node_modules/extract-text-webpack-plugin/node_modules/async/lib/async.js:44:16

how can I support 'ar_SA-u-nu-latn' in production mode?