Skip to content

Commit

Permalink
fix: require babel dependencies directly (#1575)
Browse files Browse the repository at this point in the history
**What it does:**
 - Directly require babel dependencies instead of asking babel to do it.
  • Loading branch information
Elrendio authored and endiliey committed Jun 14, 2019
1 parent a9e2194 commit a599682
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 12 deletions.
9 changes: 6 additions & 3 deletions packages/docusaurus-1.x/lib/build-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions packages/docusaurus-1.x/lib/start-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
9 changes: 6 additions & 3 deletions packages/docusaurus-1.x/lib/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
9 changes: 6 additions & 3 deletions packages/docusaurus-1.x/lib/write-translations.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a599682

Please sign in to comment.