diff --git a/.changeset/beige-moose-look.md b/.changeset/beige-moose-look.md new file mode 100644 index 0000000000..1676de210a --- /dev/null +++ b/.changeset/beige-moose-look.md @@ -0,0 +1,5 @@ +--- +'@backstage/cli': patch +--- + +Only serve static assets if there is a public folder during `app:serve` and `plugin:serve`. This fixes a common bug that would break `plugin:serve` with an `EBUSY` error. diff --git a/packages/cli/src/lib/bundler/server.ts b/packages/cli/src/lib/bundler/server.ts index 2f8e3125c1..e580cf4985 100644 --- a/packages/cli/src/lib/bundler/server.ts +++ b/packages/cli/src/lib/bundler/server.ts @@ -50,10 +50,12 @@ export async function serveBundle(options: ServeOptions) { publicPath: config.output?.publicPath as string, stats: 'errors-warnings', }, - static: { - publicPath: config.output?.publicPath as string, - directory: paths.targetPublic ?? '/', - }, + static: paths.targetPublic + ? { + publicPath: config.output?.publicPath as string, + directory: paths.targetPublic, + } + : undefined, historyApiFallback: { // Paths with dots should still use the history fallback. // See https://github.com/facebookincubator/create-react-app/issues/387.