diff --git a/packages/cli-module-build/package.json b/packages/cli-module-build/package.json index 7591007756..7f9fa0b37b 100644 --- a/packages/cli-module-build/package.json +++ b/packages/cli-module-build/package.json @@ -19,9 +19,11 @@ "license": "Apache-2.0", "main": "src/index.ts", "types": "src/index.ts", + "bin": "bin/cli-module-build", "files": [ "dist", - "bin" + "bin", + "templates" ], "scripts": { "build": "backstage-cli package build", @@ -98,6 +100,5 @@ "@types/lodash": "^4.14.151", "@types/npm-packlist": "^3.0.0", "@types/shell-quote": "^1.7.5" - }, - "bin": "bin/cli-module-build" + } } diff --git a/packages/cli-module-build/src/lib/bundler/paths.ts b/packages/cli-module-build/src/lib/bundler/paths.ts index d479f74061..5a7d3b14dc 100644 --- a/packages/cli-module-build/src/lib/bundler/paths.ts +++ b/packages/cli-module-build/src/lib/bundler/paths.ts @@ -16,7 +16,7 @@ import fs from 'fs-extra'; import { resolve as resolvePath } from 'node:path'; -import { targetPaths } from '@backstage/cli-common'; +import { targetPaths, findOwnPaths } from '@backstage/cli-common'; export type BundlingPathsOptions = { // bundle entrypoint, e.g. 'src/index' @@ -50,7 +50,9 @@ export function resolveBundlingPaths(options: BundlingPathsOptions) { targetHtml = resolvePath(targetDir, `${entry}.html`); if (!fs.pathExistsSync(targetHtml)) { /* eslint-disable-next-line no-restricted-syntax */ - targetHtml = require.resolve('@backstage/cli/templates/serve_index.html'); + targetHtml = findOwnPaths(__dirname).resolve( + 'templates/serve_index.html', + ); } } diff --git a/packages/cli-module-build/templates/serve_index.html b/packages/cli-module-build/templates/serve_index.html new file mode 100644 index 0000000000..bc91f1bc04 --- /dev/null +++ b/packages/cli-module-build/templates/serve_index.html @@ -0,0 +1,27 @@ + + +
+ + + + +