Skip to content

Conversation

@alan-agius4
Copy link
Collaborator

@alan-agius4 alan-agius4 commented Nov 13, 2025

Key changes include:

  • Removal of PNPM Hook: The .pnpmfile.cjs file, which previously converted peer dependencies into
    direct dependencies, has been deleted. This workaround is no longer necessary with the adoption of dynamic
    imports. The MODULE.bazel file has been updated to remove references to it.

  • Dynamic Imports

    • In the build_webpack package, static import statements for webpack and webpack-dev-server are
      replaced with dynamic import() calls. This defers their loading until they are actively required during
      the process.
    • In the ssr-dev-server, browser-sync is now loaded using createRequire relative to the workspace
      root, improving resolution reliability.
  • Build Configuration: Associated BUILD.bazel files have been updated to remove dependency declarations that are now obsolete due to the new lazy-loading approach.

Key changes include:

- **Removal of PNPM Hook:** The `.pnpmfile.cjs` file, which previously converted peer dependencies into
  direct dependencies, has been deleted. This workaround is no longer necessary with the adoption of dynamic
  imports. The `MODULE.bazel` file has been updated to remove references to it.

- **Dynamic Imports**
  - In the `build_webpack` package, static `import` statements for `webpack` and `webpack-dev-server` are
    replaced with dynamic `import()` calls. This defers their loading until they are actively required during
    the process.
  - In the `ssr-dev-server`, `browser-sync` is now loaded using `createRequire` relative to the workspace
    root, improving resolution reliability.

- **Build Configuration:** Associated `BUILD.bazel` files have been updated to remove dependency declarations that are now obsolete due to the new lazy-loading approach.
@alan-agius4 alan-agius4 changed the title wip! refactor: address issue with bazel resolution of peer dependencies Nov 13, 2025
@alan-agius4 alan-agius4 changed the title refactor: address issue with bazel resolution of peer dependencies refactor: address issue with bazel resolution of peer dependencies (main) Nov 13, 2025
@alan-agius4 alan-agius4 added the target: minor This PR is targeted for the next minor release label Nov 13, 2025
let browserSync: typeof import('browser-sync');
try {
browserSync = require('browser-sync');
browserSync = createRequire(context.workspaceRoot + '/')('browser-sync');
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

browser-sync is installed in the project (app), and thus the resolution should happen from the workspaceRoot not from this package.

}
} else {
return of(webpack(c));
return from(import('webpack').then((mod) => mod.default(c)));
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When a factory is not provided we should need to try to resolve webpack from this directory. This will fail when using the peerDeps of build-angular due to how modules are hoisted.

@alan-agius4 alan-agius4 added the action: review The PR is still awaiting reviews from at least one requested reviewer label Nov 13, 2025
@alan-agius4 alan-agius4 marked this pull request as ready for review November 13, 2025 09:24
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Nov 13, 2025
@alan-agius4 alan-agius4 merged commit f826968 into angular:main Nov 13, 2025
32 checks passed
@alan-agius4
Copy link
Collaborator Author

This PR was merged into the repository. The changes were merged into the following branches:

@alan-agius4 alan-agius4 deleted the pnpm-rc branch November 13, 2025 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants