rename the plugin before optimizing

When installing a plugin, if the plugin uses the file loader then the filename will be placed into a path within the ".plugin.installing" directory. This causes the build to contain invalid urls, so we need to rename the directory before optimizing

Fixes #5668
This commit is contained in:
spalger 2015-12-14 09:00:04 -07:00 committed by Khalah Jones
parent 378d956770
commit a953e82e3f
2 changed files with 8 additions and 4 deletions

View file

@ -28,7 +28,10 @@ module.exports = function (settings, logger) {
// delete the working directory.
// At this point we're bailing, so swallow any errors on delete.
try { rimraf.sync(settings.workingPath); }
try {
rimraf.sync(settings.workingPath);
rimraf.sync(settings.pluginPath);
}
catch (e) {} // eslint-disable-line no-empty
}

View file

@ -30,6 +30,9 @@ function install(settings, logger) {
.then(function () {
return downloader.download();
})
.then(function () {
fs.renameSync(settings.workingPath, settings.pluginPath);
})
.then(async function() {
logger.log('Optimizing and caching browser bundles...');
let serverConfig = _.merge(
@ -49,8 +52,7 @@ function install(settings, logger) {
},
plugins: {
initialize: false,
scanDirs: [settings.pluginDir, fromRoot('src/plugins')],
paths: [settings.workingPath]
scanDirs: [settings.pluginDir, fromRoot('src/plugins')]
}
}
);
@ -60,7 +62,6 @@ function install(settings, logger) {
await kbnServer.close();
})
.then(function () {
fs.renameSync(settings.workingPath, settings.pluginPath);
logger.log('Plugin installation complete');
})
.catch(function (e) {