Visitar URL original
fix(schematics): require only exported devkit paths from the shipped schematics by armando-navarro · Pull Request #3793 · angular/angularfire · GitHub
Skip to content

fix(schematics): require only exported devkit paths from the shipped schematics - #3793

Open
armando-navarro wants to merge 1 commit into
angular:mainfrom
armando-navarro:a68-schematics-tasks-import
Open

armando-navarro wants to merge 1 commit into
angular:mainfrom
armando-navarro:a68-schematics-tasks-import

Conversation

@armando-navarro

Copy link
Copy Markdown
Collaborator

Fixes #3789

The shipped schematics now require @angular-devkit/schematics/tasks, which every devkit version accepts, instead of @angular-devkit/schematics/tasks/index.js, which the exports map in devkit 22.3 rejects.

Changes

All in compileSchematics in tools/build.ts.

  • An esbuild alias rewrites @angular-devkit/schematics/tasks/index.js to @angular-devkit/schematics/tasks in the bundles.
  • The two source files keep the index.js spelling, because the ESM spec run cannot import the bare tasks folder from the repo's devkit 21, which has no exports map.
  • The build now fails if a bundle requires a subpath of an external package that is not listed in exportedSubpaths, and names the files that import it. The list holds @angular-devkit/schematics/tasks, @schematics/angular/utility and rxjs/operators, each of which is in its package's exports map.
  • The external package list moves into a named externalPackages constant, which the check reads.

Behavior to know

When the repo's own devkit reaches 22.3 or later, the two source imports can switch to @angular-devkit/schematics/tasks and the alias can go.

Verification

  • With the package built from this branch, the setup, add, deploy builder, v7 migration and v21 migration bundles all load with @angular-devkit/schematics 21.2.25 and 22.3.0-next.0. With the current canary, setup/index.js, deploy/builder.js and update/v21/index.js fail under 22.3.0-next.0.
  • Removing the alias fails the build with:
    The schematics require package paths that exportedSubpaths does not list:
      @angular-devkit/schematics/tasks/index.js, imported by src/schematics/utils.ts, src/schematics/update/v21/index.ts
    
  • npm run test:node: 342 specs, 0 failures.

…schematics

@angular-devkit/schematics 22.3 adds an exports map that allows ./tasks
but not ./tasks/index.js. The shipped setup, deploy builder and v21
migration bundles required tasks/index.js, so `ng update` crashed after
installing whenever it ran a 22.3 CLI, and the v21 migration never ran.

The source keeps the index.js spelling, which the ESM spec run needs
while the repo's devkit 21 has no exports map. An esbuild alias rewrites
it in the bundles, and the build now fails when a bundle requires a
package subpath that is not in exportedSubpaths, naming the importers.

typescript stays external so the v21 migration uses the compiler from
the user's workspace at ng update time, rather than adding about 3.5 MB
to the package.
@armando-navarro armando-navarro added bump: patch Size of the change: a fix or docs change that reaches users comp: schematics ng add / deploy schematics (src/schematics). type: bug Defect: expected behavior doesn't happen. labels Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bump: patch Size of the change: a fix or docs change that reaches users comp: schematics ng add / deploy schematics (src/schematics). type: bug Defect: expected behavior doesn't happen.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ng update @angular/fire stops before the v21 migration when it runs Angular CLI 22.3

1 participant