From a46cb85bacc6136987ac0f5a91fbd82293a3f232 Mon Sep 17 00:00:00 2001 From: Anton Nikolaev Date: Wed, 25 Mar 2020 03:24:00 -0700 Subject: [PATCH] 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 --- desktop/static/transforms/index.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/desktop/static/transforms/index.js b/desktop/static/transforms/index.js index 3575a89cb..8814ce2ff 100644 --- a/desktop/static/transforms/index.js +++ b/desktop/static/transforms/index.js @@ -12,18 +12,19 @@ const babylon = require('@babel/parser'); const babel = require('@babel/core'); const fs = require('fs'); 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}) { + const isMain = options.projectRoot && options.projectRoot === staticDir; const isPlugin = - options.projectRoot && options.projectRoot.includes('/desktop/plugins/'); - const isMain = options.projectRoot && - options.projectRoot === staticDir && - !options.isTestRunner; + ![staticDir, appDir, headlessDir].includes(options.projectRoot); const isTypeScript = filename.endsWith('.tsx') || filename.endsWith('.ts'); const presets = [ - isMain + isMain && !options.isTestRunner ? [ require('../node_modules/@babel/preset-env'), {targets: {electron: require('electron/package.json').version}},