Skip to content

build: remove module id references for components in release output #17625

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

Closed
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ yarn_install(
"//:tools/bazel/flat_module_factory_resolution.patch",
"//:tools/bazel/manifest_externs_hermeticity.patch",
"//:tools/bazel/postinstall-patches.js",
"//:tools/bazel/remove-module-id.patch",
"//:tools/bazel/rollup_windows_arguments.patch",
"//:tools/npm/check-npm.js",
],
Expand Down
3 changes: 3 additions & 0 deletions tools/bazel/postinstall-patches.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ searchAndReplace(/angular_compiler_options = {/, `$&
"strictAttributeTypes": False,
"strictDomEventTypes": False,`, 'node_modules/@angular/bazel/src/ng_module.bzl');

// Workaround until https://github.com/angular/angular/pull/33621 has been fixed.
shelljs.cat(path.join(__dirname, './remove-module-id.patch')).exec('patch -p0');

/**
* Reads the specified file and replaces matches of the search expression
* with the given replacement. Throws if no changes were made.
Expand Down
24 changes: 24 additions & 0 deletions tools/bazel/remove-module-id.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
diff --git node_modules/@angular/compiler-cli/src/transformers/inline_resources.js node_modules/@angular/compiler-cli/src/transformers/inline_resources.js
index 993aedc..e877a94 100644
--- node_modules/@angular/compiler-cli/src/transformers/inline_resources.js
+++ node_modules/@angular/compiler-cli/src/transformers/inline_resources.js
@@ -78,6 +78,9 @@
arg['styles'] = styles;
delete arg['styleUrls'];
}
+ if (arg['moduleId']) {
+ delete arg['moduleId'];
+ }
return arg;
};
return InlineResourcesMetadataTransformer;
@@ -271,6 +274,9 @@
var template = loader.get(prop.initializer.text);
newProperties.push(ts.updatePropertyAssignment(prop, ts.createIdentifier('template'), ts.createLiteral(template)));
break;
+ case 'moduleId':
+ // we don't want to add "moduleId" to the new object.
+ break;
default:
newProperties.push(prop);
}