logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe
commit: bebaa6eced0af2665d105beb59bd21030425245a
parent: 616f53eea81ba23d824744119aeed7cf4d22a03b
Author: Nolan Lawson <nolan@nolanlawson.com>
Date:   Tue, 10 Oct 2017 09:44:51 -0700

Remove prop types from external libraries (#5304)


Diffstat:

Mconfig/webpack/loaders/babel.js6+-----
Aconfig/webpack/loaders/babel_external.js21+++++++++++++++++++++
2 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/config/webpack/loaders/babel.js b/config/webpack/loaders/babel.js @@ -4,11 +4,7 @@ const env = process.env.NODE_ENV || 'development'; module.exports = { test: /\.js$/, - // include react-intl because transform-react-remove-prop-types needs to apply to it - exclude: { - test: /node_modules/, - exclude: /react-intl[\/\\](?!locale-data)/, - }, + exclude: /node_modules/, loader: 'babel-loader', options: { forceEnv: env, diff --git a/config/webpack/loaders/babel_external.js b/config/webpack/loaders/babel_external.js @@ -0,0 +1,21 @@ +const { resolve } = require('path'); + +const env = process.env.NODE_ENV || 'development'; + +if (env === 'development') { + module.exports = {}; +} else { + // babel options to apply only to external libraries, e.g. remove-prop-types + module.exports = { + test: /\.js$/, + include: /node_modules/, + loader: 'babel-loader', + options: { + babelrc: false, + plugins: [ + 'transform-react-remove-prop-types', + ], + cacheDirectory: env === 'development' ? false : resolve(__dirname, '..', '..', '..', 'tmp', 'cache', 'babel-loader-external'), + }, + }; +}