clean up dynamic plugin loading
Summary: There are 3 sources where plugins can be loaded from: * `src/plugins` * `src/fb/plugins` * any path specified in `~/.sonar/config.json` Plugins found in the first two directories are bundled with the app when building. Reviewed By: jknoxville Differential Revision: D8636061 fbshipit-source-id: 2064090d43d11695ffd99df195e5b594559fe087
This commit is contained in:
committed by
Facebook Github Bot
parent
70e11e8269
commit
5edb8bd770
@@ -8,7 +8,6 @@
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const metro = require('metro');
|
||||
const yargs = require('yargs');
|
||||
const HOME_DIR = require('os').homedir();
|
||||
|
||||
module.exports = (reloadCallback, pluginPaths, pluginCache) => {
|
||||
@@ -16,10 +15,7 @@ module.exports = (reloadCallback, pluginPaths, pluginCache) => {
|
||||
if (!fs.existsSync(pluginCache)) {
|
||||
fs.mkdirSync(pluginCache);
|
||||
}
|
||||
if (yargs.argv.dynamicPlugins) {
|
||||
// watch for changes on plugins if we are loading plugins dynamically
|
||||
watchChanges(plugins, reloadCallback, pluginCache);
|
||||
}
|
||||
watchChanges(plugins, reloadCallback, pluginCache);
|
||||
return Promise.all(
|
||||
Object.values(plugins).map(plugin =>
|
||||
compilePlugin(plugin, false, pluginCache),
|
||||
@@ -178,7 +174,12 @@ function compilePlugin(
|
||||
changeExport(out);
|
||||
resolve(result);
|
||||
})
|
||||
.catch(console.error);
|
||||
.catch(err => {
|
||||
console.error(
|
||||
`❌ Plugin ${name} is ignored, because it could not be compiled.`,
|
||||
);
|
||||
console.error(err);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user