Fix open source yarn start
Summary: The fb-stubs transform is getting applied when it shouldn't. Fix it by only applying it if src/fb exists. Reviewed By: danielbuechele Differential Revision: D13236217 fbshipit-source-id: 940def377839d16f34c49504948cb062916a3d6a
This commit is contained in:
committed by
Facebook Github Bot
parent
ec1e977084
commit
54d09aa951
@@ -8,6 +8,8 @@
|
|||||||
const generate = require('@babel/generator').default;
|
const generate = require('@babel/generator').default;
|
||||||
const babylon = require('@babel/parser');
|
const babylon = require('@babel/parser');
|
||||||
const babel = require('@babel/core');
|
const babel = require('@babel/core');
|
||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
function transform({filename, options, src}) {
|
function transform({filename, options, src}) {
|
||||||
const presets = [require('../node_modules/@babel/preset-react')];
|
const presets = [require('../node_modules/@babel/preset-react')];
|
||||||
@@ -33,10 +35,17 @@ function transform({filename, options, src}) {
|
|||||||
require('../node_modules/@babel/plugin-proposal-class-properties'),
|
require('../node_modules/@babel/plugin-proposal-class-properties'),
|
||||||
require('../node_modules/@babel/plugin-transform-flow-strip-types'),
|
require('../node_modules/@babel/plugin-transform-flow-strip-types'),
|
||||||
require('../node_modules/@babel/plugin-proposal-optional-chaining'),
|
require('../node_modules/@babel/plugin-proposal-optional-chaining'),
|
||||||
require('./fb-stubs.js'),
|
|
||||||
require('./dynamic-requires.js'),
|
require('./dynamic-requires.js'),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if (
|
||||||
|
fs.existsSync(
|
||||||
|
path.resolve(path.dirname(path.dirname(__dirname)), 'src', 'fb'),
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
plugins.push(require('./fb-stubs.js'));
|
||||||
|
}
|
||||||
|
|
||||||
if (options.isTestRunner) {
|
if (options.isTestRunner) {
|
||||||
if (process.env.USE_ELECTRON_STUBS) {
|
if (process.env.USE_ELECTRON_STUBS) {
|
||||||
plugins.push(require('./electron-stubs.js'));
|
plugins.push(require('./electron-stubs.js'));
|
||||||
|
|||||||
Reference in New Issue
Block a user