Skip to content

build: remove flat module bundle workaround from view engine #23826

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
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
21 changes: 0 additions & 21 deletions tools/defaults.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -108,34 +108,14 @@ def ng_module(
deps = [],
srcs = [],
tsconfig = None,
flat_module_out_file = None,
testonly = False,
**kwargs):
if not tsconfig:
tsconfig = _getDefaultTsConfig(testonly)

# We only generate a flat module if there is a "public-api.ts" file that
# will be picked up by NGC or ngtsc.
needs_flat_module = "public-api.ts" in srcs

# Compute an AMD module name for the target.
module_name = _compute_module_name(testonly)

# Targets which have a module name and are not used for tests, should
# have a default flat module out file named "index". This is necessary
# as imports to that target should go through the flat module bundle.
if needs_flat_module and module_name and not flat_module_out_file and not testonly:
flat_module_out_file = "index"

# Workaround to avoid a lot of changes to the Bazel build rules. Since
# for most targets the flat module out file is "index.js", we cannot
# include "index.ts" (if present) as source-file. This would resolve
# in a conflict in the metadata bundler. Once we switch to Ivy and
# no longer need metadata bundles, we can remove this logic.
if flat_module_out_file == "index":
if "index.ts" in srcs:
srcs.remove("index.ts")

local_deps = [
# Add tslib because we use import helpers for all public packages.
"@npm//tslib",
Expand All @@ -155,7 +135,6 @@ def ng_module(
# NodeJS executions, by activating the Bazel NodeJS linker.
# See: https://github.com/bazelbuild/rules_nodejs/pull/2799.
package_name = module_name,
flat_module_out_file = flat_module_out_file,
strict_templates = True,
deps = local_deps,
tsconfig = tsconfig,
Expand Down
11 changes: 1 addition & 10 deletions tools/postinstall/apply-patches.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const chalk = require('chalk');
* Version of the post install patch. Needs to be incremented when
* existing patches or edits have been modified.
*/
const PATCH_VERSION = 13;
const PATCH_VERSION = 14;

/** Path to the project directory. */
const projectDir = path.join(__dirname, '../..');
Expand Down Expand Up @@ -52,15 +52,6 @@ async function main() {
}

function applyPatches() {
// Workaround for: https://github.com/angular/angular/pull/32650
searchAndReplace(
'let resolvedEntryPoint = null;',
`
let resolvedEntryPoint = tsFiles.find(f => f.endsWith('/public-api.ts')) || null;
`,
'node_modules/@angular/compiler-cli/bundles/index.js',
);

// Switches the devmode output for Angular Bazel to ES2020 target and module.
applyPatch(path.join(__dirname, './devmode-es2020-bazel.patch'));

Expand Down