Skip to content
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

Define build option does not define values for prebundling #29278

Closed
1 task
HazzMan2409 opened this issue Jan 8, 2025 · 1 comment · Fixed by #29279
Closed
1 task

Define build option does not define values for prebundling #29278

HazzMan2409 opened this issue Jan 8, 2025 · 1 comment · Fixed by #29279

Comments

@HazzMan2409
Copy link

HazzMan2409 commented Jan 8, 2025

Command

serve

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

The define build option is not passed on for prebundling https://github.com/angular/angular-cli/blob/main/packages/angular/build/src/tools/vite/utils.ts#L101 and so library code that relies on a global variable being set cannot be prebundled.

Minimal Reproduction

Pre-bundle a library that relies on a global.

Exception or Error


Your Environment

Angular CLI: 19.0.6
Node: 20.12.1
Package Manager: npm 10.5.0
OS: darwin arm64

Angular: 19.0.5
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1900.6
@angular-devkit/build-angular   19.0.6
@angular-devkit/core            19.0.6
@angular-devkit/schematics      19.0.6
@angular/cli                    19.0.6
@schematics/angular             19.0.6
rxjs                            7.8.1
typescript                      5.6.3
zone.js                         0.15.0

Anything else relevant?

No response

@alan-agius4
Copy link
Collaborator

Actually this is slightly different.

alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Jan 8, 2025
…der to Vite prebundling

This update ensures that the `define` option is correctly passed to Vite during the prebundling phase of the application builder, improving compatibility and optimization of the build process.

Closes angular#29278
alan-agius4 added a commit that referenced this issue Jan 8, 2025
…der to Vite prebundling

This update ensures that the `define` option is correctly passed to Vite during the prebundling phase of the application builder, improving compatibility and optimization of the build process.

Closes #29278

(cherry picked from commit 8639a3b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants