about summary refs log tree commit diff
path: root/babel.config.js
diff options
context:
space:
mode:
Diffstat (limited to 'babel.config.js')
-rw-r--r--babel.config.js26
1 files changed, 16 insertions, 10 deletions
diff --git a/babel.config.js b/babel.config.js
index 55efafc40..9be5b547a 100644
--- a/babel.config.js
+++ b/babel.config.js
@@ -1,30 +1,39 @@
 module.exports = (api) => {
   const env = api.env();
 
+  const reactOptions = {
+    development: false,
+  };
+
   const envOptions = {
-    debug: false,
     loose: true,
     modules: false,
+    debug: false,
   };
 
   const config = {
     presets: [
-      '@babel/react',
+      ['@babel/react', reactOptions],
       ['@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/' }],
+      ['react-intl', { messagesDir: './build/messages' }],
       'preval',
     ],
+    overrides: [
+      {
+        test: /tesseract\.js/,
+        presets: [
+          ['@babel/env', { ...envOptions, modules: 'commonjs' }],
+        ],
+      },
+    ],
   };
 
   switch (env) {
   case 'production':
-    envOptions.debug = false;
     config.plugins.push(...[
       'lodash',
       [
@@ -49,11 +58,8 @@ module.exports = (api) => {
     ]);
     break;
   case 'development':
+    reactOptions.development = true;
     envOptions.debug = true;
-    config.plugins.push(...[
-      '@babel/transform-react-jsx-source',
-      '@babel/transform-react-jsx-self',
-    ]);
     break;
   case 'test':
     envOptions.modules = 'commonjs';