]> cat aescling's git repositories - mastodon.git/commitdiff
Fix react-intl/locale-data import issue on production build (#3937)
authorunarist <m.unarist@gmail.com>
Sun, 25 Jun 2017 10:49:53 +0000 (19:49 +0900)
committerEugen Rochko <eugen@zeonfederated.com>
Sun, 25 Jun 2017 10:49:53 +0000 (12:49 +0200)
Webpack seems to fail to import `react-intl/locale-data/*.js` if those
files has been proceed by babel, and this also breaks applying our translation.

Note that this won't be a problem on English locale, because react-intl
includes it as default and works fine without manually added locale-data.
Also this issue seems to only occurs on production build, but I'm not sure
about reason.

config/webpack/loaders/babel.js

index ae65db9eb5917d199508eab99904cd02d812d449..a1992a450a90fba5322b34ae48870d55a12bb2c3 100644 (file)
@@ -1,7 +1,10 @@
 module.exports = {
   test: /\.js$/,
   // include react-intl because transform-react-remove-prop-types needs to apply to it
-  exclude: /node_modules[\/\\](?!react-intl)/,
+  exclude: {
+    test: /node_modules/,
+    exclude: /react-intl[\/\\](?!locale-data)/,
+  },
   loader: 'babel-loader',
   options: {
     forceEnv: process.env.NODE_ENV || 'development',