Fix compilation of plugins in run-time after installation
Summary: Fixed compilation of installed plugins in run-time Reviewed By: passy Differential Revision: D20642377 fbshipit-source-id: d5012c88eebf1f7106de538b84c7695048408924
This commit is contained in:
committed by
Facebook GitHub Bot
parent
49fc4b46b6
commit
a46cb85bac
@@ -12,18 +12,19 @@ const babylon = require('@babel/parser');
|
|||||||
const babel = require('@babel/core');
|
const babel = require('@babel/core');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const staticDir = path.resolve(__dirname, '..');
|
const rootDir = path.resolve(__dirname, '..', '..');
|
||||||
|
const staticDir = path.join(rootDir, 'static');
|
||||||
|
const appDir = path.join(rootDir, 'app');
|
||||||
|
const headlessDir = path.join(rootDir, 'headless');
|
||||||
|
|
||||||
function transform({filename, options, src}) {
|
function transform({filename, options, src}) {
|
||||||
|
const isMain = options.projectRoot && options.projectRoot === staticDir;
|
||||||
const isPlugin =
|
const isPlugin =
|
||||||
options.projectRoot && options.projectRoot.includes('/desktop/plugins/');
|
|
||||||
const isMain =
|
|
||||||
options.projectRoot &&
|
options.projectRoot &&
|
||||||
options.projectRoot === staticDir &&
|
![staticDir, appDir, headlessDir].includes(options.projectRoot);
|
||||||
!options.isTestRunner;
|
|
||||||
const isTypeScript = filename.endsWith('.tsx') || filename.endsWith('.ts');
|
const isTypeScript = filename.endsWith('.tsx') || filename.endsWith('.ts');
|
||||||
const presets = [
|
const presets = [
|
||||||
isMain
|
isMain && !options.isTestRunner
|
||||||
? [
|
? [
|
||||||
require('../node_modules/@babel/preset-env'),
|
require('../node_modules/@babel/preset-env'),
|
||||||
{targets: {electron: require('electron/package.json').version}},
|
{targets: {electron: require('electron/package.json').version}},
|
||||||
|
|||||||
Reference in New Issue
Block a user