Skip to content

Commit 807f468

Browse files
committed
docs: add new plugin factory function feature to migration guide - Document the new capability for plugins to access builder options and target - Mark as non-breaking enhancement - Provide clear example of the new functionality
1 parent baf8679 commit 807f468

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

MIGRATION.MD

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,32 @@
2525
}
2626
```
2727

28+
2. **New Feature:** Plugins can now access builder options and target information through factory functions. This is a **non-breaking** enhancement - existing plugins continue to work unchanged.
29+
30+
**New capability:**
31+
```ts
32+
// esbuild/plugins.ts
33+
import type { Plugin } from 'esbuild';
34+
import type { ApplicationBuilderOptions } from '@angular-devkit/build-angular';
35+
import type { Target } from '@angular-devkit/architect';
36+
37+
export default (builderOptions: ApplicationBuilderOptions, target: Target): Plugin => {
38+
return {
39+
name: 'project-aware-plugin',
40+
setup(build) {
41+
// Access current project name
42+
build.initialOptions.define.PROJECT_NAME = JSON.stringify(target.project);
43+
44+
// Access builder options like outputPath, tsConfig, etc.
45+
console.log('Building for project:', target.project);
46+
console.log('Output path:', builderOptions.outputPath);
47+
},
48+
};
49+
};
50+
```
51+
52+
This enables more sophisticated plugins that can adapt their behavior based on the current build target and configuration.
53+
2854
## Custom Webpack builder
2955

3056
- No breaking changes (except for updating to Angular 20)

0 commit comments

Comments
 (0)