error plugin import from outside

Summary:
Plugins can not require files outside their folder, to make sure they don't pull in any dependencies from Flipper which are not exported by the main app.

However, those imports simply resolve to `undefined`. This diff adds a check in the babel-transform for plugins and throws an error if something from outside the plugin is required.

Reviewed By: passy

Differential Revision: D10297980

fbshipit-source-id: 1606f3211103281f9f4aa7bb2f3ca4d085d0ea1b
This commit is contained in:
Daniel Büchele
2018-10-11 07:00:58 -07:00
committed by Facebook Github Bot
parent de85f9d455
commit 992ad68517
3 changed files with 95 additions and 17 deletions

View File

@@ -57,6 +57,7 @@ function transform({filename, options, src}) {
code: false,
comments: false,
compact: false,
root: options.projectRoot,
filename,
plugins,
presets,