diff --git a/WORKSPACE b/WORKSPACE index d565058b4243..cdeefc0f9121 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -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", ], diff --git a/tools/bazel/postinstall-patches.js b/tools/bazel/postinstall-patches.js index 82b65e52daae..37ce661bf028 100644 --- a/tools/bazel/postinstall-patches.js +++ b/tools/bazel/postinstall-patches.js @@ -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. diff --git a/tools/bazel/remove-module-id.patch b/tools/bazel/remove-module-id.patch new file mode 100644 index 000000000000..3a3b54f3ade1 --- /dev/null +++ b/tools/bazel/remove-module-id.patch @@ -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); + }