packages/cli: output index.html.tmpl

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2024-08-30 13:42:19 +02:00
parent 7310b97bd4
commit 0e1a817a26
5 changed files with 34 additions and 4 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/cli': patch
---
The app build process now outputs an additional `index.html.tmpl` file. This is an non-templated version of the `index.html` file, which can be used to delay templating until runtime.
+1
View File
@@ -130,6 +130,7 @@
"pirates": "^4.0.6",
"postcss": "^8.1.0",
"process": "^0.11.10",
"raw-loader": "^4.0.2",
"react-dev-utils": "^12.0.0-next.60",
"react-refresh": "^0.14.0",
"recursive-readdir": "^2.2.2",
+11
View File
@@ -198,6 +198,17 @@ export async function createConfig(
},
}),
);
plugins.push(
new HtmlWebpackPlugin({
meta: {
'backstage-app-mode': options?.appMode ?? 'public',
},
minify: false,
publicPath: '<%= publicPath %>',
filename: 'index.html.tmpl',
template: `raw-loader!${paths.targetHtml}`,
}),
);
}
if (options.moduleFederation) {
+2 -2
View File
@@ -14,12 +14,12 @@
* limitations under the License.
*/
import { ModuleOptions, WebpackPluginInstance } from 'webpack';
import { RuleSetRule, WebpackPluginInstance } from 'webpack';
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
import { svgrTemplate } from '../svgrTemplate';
type Transforms = {
loaders: ModuleOptions['rules'];
loaders: RuleSetRule[];
plugins: WebpackPluginInstance[];
};
+15 -2
View File
@@ -3996,6 +3996,7 @@ __metadata:
pirates: ^4.0.6
postcss: ^8.1.0
process: ^0.11.10
raw-loader: ^4.0.2
react-dev-utils: ^12.0.0-next.60
react-refresh: ^0.14.0
recursive-readdir: ^2.2.2
@@ -32573,7 +32574,7 @@ __metadata:
languageName: node
linkType: hard
"loader-utils@npm:^2.0.4":
"loader-utils@npm:^2.0.0, loader-utils@npm:^2.0.4":
version: 2.0.4
resolution: "loader-utils@npm:2.0.4"
dependencies:
@@ -38143,6 +38144,18 @@ __metadata:
languageName: node
linkType: hard
"raw-loader@npm:^4.0.2":
version: 4.0.2
resolution: "raw-loader@npm:4.0.2"
dependencies:
loader-utils: ^2.0.0
schema-utils: ^3.0.0
peerDependencies:
webpack: ^4.0.0 || ^5.0.0
checksum: 51cc1b0d0e8c37c4336b5318f3b2c9c51d6998ad6f56ea09612afcfefc9c1f596341309e934a744ae907177f28efc9f1654eacd62151e82853fcc6d37450e795
languageName: node
linkType: hard
"rc-progress@npm:3.5.1":
version: 3.5.1
resolution: "rc-progress@npm:3.5.1"
@@ -40166,7 +40179,7 @@ __metadata:
languageName: node
linkType: hard
"schema-utils@npm:^3.1.1, schema-utils@npm:^3.2.0":
"schema-utils@npm:^3.0.0, schema-utils@npm:^3.1.1, schema-utils@npm:^3.2.0":
version: 3.3.0
resolution: "schema-utils@npm:3.3.0"
dependencies: