Skip to content

Angular plugin and schematic #50

@peterpeterparker

Description

@peterpeterparker

Given that Angular uses esbuild, it should be possible to provide a plugin for Angular as well.

// angular.json
{
  "projects": {
    "app": {
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:application",
          "options": {
            "plugins": ["@junobuild/angular-plugin"]
          }
        }
      }
    }
  }
}

Maybe we also want a schematic to do

ng add @junobuild/angular-plugin

Something

// schematics/ng-add/index.ts
import { Rule, SchematicContext, Tree } from '@angular-devkit/schematics';

export function ngAdd(): Rule {
  return (tree: Tree, context: SchematicContext) => {
    // Modify angular.json to add the plugin
    const angularJson = JSON.parse(tree.read('angular.json')!.toString());
    // ... add plugin to build options
    tree.overwrite('angular.json', JSON.stringify(angularJson, null, 2));
    return tree;
  };
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions