Esri / arcgis-webpack-plugin

Webpack plugin for the ArcGIS API for JavaScript
Apache License 2.0
134 stars 26 forks source link

Keep fallback language files #107

Closed tlbonum closed 10 months ago

tlbonum commented 3 years ago

Hi, not sure what causes this, but some of our clients attempts to load the default/fallback(?) locale files, (the ones not suffixed by _.json, i.e. Legend.json instead of Legend_en.json). We are seeing the following error in our logs:

["[esri.widgets.Widget]","widget-intl:locale-error","esri.widgets.Legend",{"details":{"errors":"[Array]"},"message":"Errors occurred while loading \"esri/widgets/Legend/t9n/Legend\"","name":"intl:message-bundle-error"}]

This happens because the plugin ignores copying these files, if the "locales" option is used. Maybe this is intentional, and there's actually a way to force clients to use a specific locale?

The following patch keeps the files:

diff --git a/node_modules/@arcgis/webpack-plugin/lib/requiredPlugins.js b/node_modules/@arcgis/webpack-plugin/lib/requiredPlugins.js
index 428465d..eada295 100644
--- a/node_modules/@arcgis/webpack-plugin/lib/requiredPlugins.js
+++ b/node_modules/@arcgis/webpack-plugin/lib/requiredPlugins.js
@@ -48,7 +48,7 @@ module.exports = function requiredPlugins(locales = []) {
   }

   const localesIgnoreList = locales.map((locale) => `*_${locale}`).join("|");
-  const localesIgnoreGlob = `**/!(${localesIgnoreList}).json`;
+  const localesIgnoreGlob = `**/!(${localesIgnoreList}|!(*_*)).json`;
   const ignoreSass = "**/*.scss";
   return [
     // Copy non-packed resources needed by the app to the build directory

This issue body was partially generated by patch-package.

odoe commented 3 years ago

I'll take a look at the copy script. It's probably missing the widget ones.

github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

andygup commented 10 months ago

Closing issue in preparation for repo archiving.