From a5996829efe759083be1689c349e13ef04f6806b Mon Sep 17 00:00:00 2001 From: Oscar Walter Date: Fri, 14 Jun 2019 06:58:46 +0200 Subject: [PATCH] fix: require babel dependencies directly (#1575) **What it does:** - Directly require babel dependencies instead of asking babel to do it. --- packages/docusaurus-1.x/lib/build-files.js | 9 ++++++--- packages/docusaurus-1.x/lib/start-server.js | 9 ++++++--- packages/docusaurus-1.x/lib/version.js | 9 ++++++--- packages/docusaurus-1.x/lib/write-translations.js | 9 ++++++--- 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/packages/docusaurus-1.x/lib/build-files.js b/packages/docusaurus-1.x/lib/build-files.js index d95c16d96d77..ecbb2a53c678 100755 --- a/packages/docusaurus-1.x/lib/build-files.js +++ b/packages/docusaurus-1.x/lib/build-files.js @@ -13,10 +13,13 @@ require('@babel/register')({ only: [__dirname, `${process.cwd()}/core`], plugins: [ require('./server/translate-plugin.js'), - '@babel/plugin-proposal-class-properties', - '@babel/plugin-proposal-object-rest-spread', + require('@babel/plugin-proposal-class-properties').default, + require('@babel/plugin-proposal-object-rest-spread').default, + ], + presets: [ + require('@babel/preset-react').default, + require('@babel/preset-env').default, ], - presets: ['@babel/react', '@babel/env'], }); // initial check that required files are present diff --git a/packages/docusaurus-1.x/lib/start-server.js b/packages/docusaurus-1.x/lib/start-server.js index d33e4922e6a7..071ef73e5ca3 100755 --- a/packages/docusaurus-1.x/lib/start-server.js +++ b/packages/docusaurus-1.x/lib/start-server.js @@ -12,10 +12,13 @@ require('@babel/register')({ only: [__dirname, `${process.cwd()}/core`], plugins: [ require('./server/translate-plugin.js'), - '@babel/plugin-proposal-class-properties', - '@babel/plugin-proposal-object-rest-spread', + require('@babel/plugin-proposal-class-properties').default, + require('@babel/plugin-proposal-object-rest-spread').default, + ], + presets: [ + require('@babel/preset-react').default, + require('@babel/preset-env').default, ], - presets: ['@babel/react', '@babel/env'], }); const chalk = require('chalk'); diff --git a/packages/docusaurus-1.x/lib/version.js b/packages/docusaurus-1.x/lib/version.js index 42862184fe9c..3dfbc8e5eb70 100755 --- a/packages/docusaurus-1.x/lib/version.js +++ b/packages/docusaurus-1.x/lib/version.js @@ -12,10 +12,13 @@ require('@babel/register')({ only: [__dirname, `${process.cwd()}/core`], plugins: [ require('./server/translate-plugin.js'), - '@babel/plugin-proposal-class-properties', - '@babel/plugin-proposal-object-rest-spread', + require('@babel/plugin-proposal-class-properties').default, + require('@babel/plugin-proposal-object-rest-spread').default, + ], + presets: [ + require('@babel/preset-react').default, + require('@babel/preset-env').default, ], - presets: ['@babel/react', '@babel/env'], }); const program = require('commander'); diff --git a/packages/docusaurus-1.x/lib/write-translations.js b/packages/docusaurus-1.x/lib/write-translations.js index 2b0f3add4a0e..32f8464f06ba 100755 --- a/packages/docusaurus-1.x/lib/write-translations.js +++ b/packages/docusaurus-1.x/lib/write-translations.js @@ -14,10 +14,13 @@ require('@babel/register')({ only: [__dirname, `${process.cwd()}/core`], plugins: [ require('./server/translate-plugin.js'), - '@babel/plugin-proposal-class-properties', - '@babel/plugin-proposal-object-rest-spread', + require('@babel/plugin-proposal-class-properties').default, + require('@babel/plugin-proposal-object-rest-spread').default, + ], + presets: [ + require('@babel/preset-react').default, + require('@babel/preset-env').default, ], - presets: ['@babel/react', '@babel/env'], }); const traverse = require('@babel/traverse').default;