Skip to content

why set additionalProperties:false when use esbuild? #30155

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

Closed
lhbvita opened this issue Apr 23, 2025 · 5 comments
Closed

why set additionalProperties:false when use esbuild? #30155

lhbvita opened this issue Apr 23, 2025 · 5 comments

Comments

@lhbvita
Copy link

lhbvita commented Apr 23, 2025

Command

build

Description

"name": "@angular-devkit/build-angular",
"version": "17.3.8",
file: node_modules@angular-devkit\build-angular\src\builders\browser-esbuild\schema.json
the root property "additionalProperties": false

i'm writing a custom builder based on browser-esbuild with additional properties, but i find the additionalProperties is false, so it throws errors.
i wonder why angular set this property false, can it be true?

Describe the solution you'd like

No response

Describe alternatives you've considered

No response

@alan-agius4
Copy link
Collaborator

This behavior is intentional, it ensures an error occurs when unknown options are passed. In your case, you can explicitly copying over the options you want to expose.

Out of curiosity why do you need to extend browser-esbuild?

@alan-agius4 alan-agius4 closed this as not planned Won't fix, can't repro, duplicate, stale Apr 23, 2025
@lhbvita
Copy link
Author

lhbvita commented Apr 25, 2025

@alan-agius4
hi, i want to use loader

component:
import { Component } from "@angular/core"; import { RouterOutlet } from "@angular/router"; import networksvg from "./network.svg"; @Component({ selector: "app-root", standalone: true, imports: [RouterOutlet], templateUrl: "./app.component.html", styleUrl: "./app.component.scss" }) export class AppComponent { title = "my-app"; svg = networksvg; }
angular.json:
"builder": "@angular-devkit/build-angular:browser-esbuild"

Image

if i add loader option to angular.json show errors:
"loader":{ "svg":"file" }
Image

@alan-agius4
Copy link
Collaborator

You can use loaders with the application builder. The browser-esbuild is intended as a compatibility builder and is not recommended unless you frequently switch between Webpack and esbuild.

Additionally, new features will not be added to both browser-esbuild and the webpack based builders.

@lhbvita
Copy link
Author

lhbvita commented Apr 25, 2025

@alan-agius4
but application builder not support custom index transformer or other additional options either, right?

@alan-agius4
Copy link
Collaborator

But application builder not support custom index transformer or other additional options either, right?

Like browser-esbuild, the application builder only supports this options via the API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants