Skip to content

feat(angular-rspack): support index transformer #118

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 27, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -157,13 +157,11 @@ export type IndexExpandedDefinition = {
input: string;
output?: string;
preloadInitial?: boolean;
transformer?: IndexHtmlTransform;
};
export type IndexElement = IndexExpandedDefinition | string | false;
export type IndexHtmlTransform = (content: string) => Promise<string>;
export type NormalizedIndexElement =
| IndexExpandedDefinition & {
transformer: IndexHtmlTransform | undefined;
};
export type NormalizedIndexElement = IndexExpandedDefinition;

export type NormalizedEntryPoint = Required<
Exclude<ScriptOrStyleEntry, string>
4 changes: 2 additions & 2 deletions packages/angular-rspack/src/lib/models/normalize-options.ts
Original file line number Diff line number Diff line change
@@ -201,8 +201,8 @@ export async function normalizeOptions(
typeof options.index === 'string' ? options.index : options.index.input
),
output: indexOutput,
// @TODO: Add support for transformer
transformer: undefined,
transformer:
typeof options.index === 'object' ? options.index.transformer : undefined,
// Preload initial defaults to true
preloadInitial:
typeof options.index !== 'object' ||
1 change: 1 addition & 0 deletions packages/angular-rspack/src/lib/plugins/ng-rspack.ts
Original file line number Diff line number Diff line change
@@ -132,6 +132,7 @@ export class NgRspackPlugin implements RspackPluginInstance {
),
i18n: this.i18n,
optimization: this.pluginOptions.optimization,
postTransform: this.pluginOptions.index.transformer,
isSsr: !!(
this.pluginOptions.ssr ||
this.pluginOptions.prerender ||