diff --git a/webpack/rules/babel-build-config.js b/webpack/rules/babel-build-config.js new file mode 100644 index 000000000..78e2b47aa --- /dev/null +++ b/webpack/rules/babel-build-config.js @@ -0,0 +1,19 @@ +const { resolve } = require('path'); +const { env } = require('../configuration'); + +// This is a hack, used to force build_config @preval to recompile +// https://github.com/kentcdodds/babel-plugin-preval/issues/19 + +module.exports = { + test: resolve(__dirname, '../../app/soapbox/build_config.js'), + use: [ + { + loader: 'babel-loader', + options: { + cacheDirectory: false, + cacheCompression: env.NODE_ENV === 'production', + compact: env.NODE_ENV === 'production', + }, + }, + ], +}; diff --git a/webpack/rules/index.js b/webpack/rules/index.js index 467b23f22..91a4abd19 100644 --- a/webpack/rules/index.js +++ b/webpack/rules/index.js @@ -1,6 +1,7 @@ const babel = require('./babel'); const git = require('./babel-git'); const gitRefresh = require('./git-refresh'); +const buildConfig = require('./babel-build-config'); const css = require('./css'); const file = require('./file'); const nodeModules = require('./node_modules'); @@ -15,4 +16,5 @@ module.exports = [ babel, git, gitRefresh, + buildConfig, ];