diff options
author | Thibaut Girka <thib@sitedethib.com> | 2018-09-19 21:46:01 +0200 |
---|---|---|
committer | Thibaut Girka <thib@sitedethib.com> | 2018-09-19 21:46:01 +0200 |
commit | 91bef4759f40422b64d7990f9b90db0b493773b1 (patch) | |
tree | 3211b1014a6d0a88737db16c44d210ef96a070e4 /babel.config.js | |
parent | 382cdd7f959480d59fee5646be320d6076cb18d8 (diff) | |
parent | 554f659f2aa1eb9c0ca64ec1c9c177538434826c (diff) |
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts: Vagrantfile app/javascript/packs/public.js app/views/admin/settings/edit.html.haml app/views/settings/preferences/show.html.haml app/views/settings/profiles/show.html.haml config/locales/es.yml config/locales/simple_form.en.yml config/webpack/configuration.js config/webpack/loaders/babel.js package.json yarn.lock Split new additions to app/javascript/packs/public.js to app/javascript/core/settings.js
Diffstat (limited to 'babel.config.js')
-rw-r--r-- | babel.config.js | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/babel.config.js b/babel.config.js new file mode 100644 index 000000000..a506ad8ce --- /dev/null +++ b/babel.config.js @@ -0,0 +1,65 @@ +module.exports = (api) => { + const env = api.env(); + + const envOptions = { + debug: false, + loose: true, + modules: false, + }; + + const config = { + presets: [ + '@babel/react', + ['@babel/env', envOptions], + ], + plugins: [ + '@babel/syntax-dynamic-import', + ['@babel/proposal-object-rest-spread', { useBuiltIns: true }], + ['@babel/proposal-decorators', { legacy: true }], + '@babel/proposal-class-properties', + ['react-intl', { messagesDir: './build/messages' }], + 'preval', + ], + }; + + switch (env) { + case 'production': + envOptions.debug = false; + config.plugins.push(...[ + 'lodash', + [ + 'transform-react-remove-prop-types', + { + mode: 'remove', + removeImport: true, + additionalLibraries: [ + 'react-immutable-proptypes', + ], + }, + ], + '@babel/transform-react-inline-elements', + [ + '@babel/transform-runtime', + { + helpers: true, + regenerator: false, + useESModules: true, + }, + ], + ]); + break; + case 'development': + envOptions.debug = true; + config.plugins.push(...[ + '@babel/transform-react-jsx-source', + '@babel/transform-react-jsx-self', + ]); + break; + case 'test': + envOptions.modules = 'commonjs'; + break; + } + + return config; +}; + |