Skip to content

Commit 04634ac

Browse files
committed
headlamp-plugin: Ensure the dist files are all copied on npm run start
Only the index.js and package.json were being copied to the plugin folder. This was because the copy of the extra dist files was happening on "close bundle" rather than on "build end", i.e. it was happening only after copying the static files. This patch fixes that and also moves the setting up of the static copy to after the setting up of the extra-dist-files logic. This has no real effect but makes the code more readable since it's ordered like it actually is processed. Signed-off-by: Joaquim Rocha <[email protected]>
1 parent 0aaf599 commit 04634ac

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

plugins/headlamp-plugin/bin/headlamp-plugin.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -435,8 +435,6 @@ async function start() {
435435
const config = (await viteConfigPromise).default;
436436
const vite = await vitePromise;
437437

438-
await copyToPluginsFolder(config);
439-
440438
if (config.build) {
441439
config.build.watch = {};
442440
config.build.sourcemap = 'inline';
@@ -446,12 +444,15 @@ async function start() {
446444
if (config.plugins) {
447445
config.plugins.push({
448446
name: 'headlamp-copy-extra-dist',
449-
closeBundle: async () => {
447+
buildEnd: async () => {
450448
await copyExtraDistFiles();
451449
},
452450
});
453451
}
454452

453+
// Then add the plugins from copyToPluginsFolder which includes ViteStaticCopy
454+
await copyToPluginsFolder(config);
455+
455456
try {
456457
await vite.build(config);
457458
} catch (e) {

0 commit comments

Comments
 (0)