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

Angular - Fixing the Vite builder warning problem #22073

Merged
merged 1 commit into from
Feb 4, 2025
Merged

Conversation

sumeyyeKurtulus
Copy link
Contributor

@sumeyyeKurtulus sumeyyeKurtulus commented Feb 4, 2025

Description

Resolves #21448

There should not be any warning as in the record

Screen.Recording.2025-02-04.at.12.01.41.mov

Checklist

  • I fully tested it as developer / designer and created unit / integration tests
  • No need to update documentation specifically for this.

How to test it?

  • You need to get the latest changes to the app template by running yarn copy-to:app under npm > ng-pack directory.
  • You need to replace the registerLocale() function with registerLocaleForEsBuild() function in templates > app > angular > src > app > app.module.ts
  • You need to run this command ng update @angular/cli --name use-application-builder under templates > app > angular
  • Then you can start the app check the console for this specific warning and it should not be there 😄
vite/deps/@abp_ng__core_locale.js
87 |          /* webpackInclude: /[/\\](ar|cs|en|en-GB|es|de|fi|fr|hi|hu|is|it|pt|tr|ru|ro|sk|sl|zh-Hans|zh-Hant)\.(mjs|js)$/ */
88 |          /* webpackExclude: /[/\\]global|extra/ */
89 |          `@angular/common${localePath}`
   |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
90 |        ).then((val) => {
91 |          let module = val;
The above dynamic import cannot be analyzed by Vite.
See https://github.com/rollup/plugins/tree/master/packages/dynamic-import-vars#limitations for supported dynamic import formats. If this is intended to be left as-is, you can use the /* @vite-ignore */ comment inside the import() call to suppress this warning.

@sumeyyeKurtulus sumeyyeKurtulus added this to the 9.0-patch-final milestone Feb 4, 2025
@sumeyyeKurtulus sumeyyeKurtulus marked this pull request as ready for review February 4, 2025 10:46
@sumeyyeKurtulus
Copy link
Contributor Author

Hello @ismcagdas, I founded that this warning occurs since then the application builder uses Vite instead of Webpack. So, even if we do not call the specific function, Vite builds the whole file and throws such a warning for the dynamic inputs. Since it is not a critical warning and the app uses a different function instead, I added this specific comment line for the time being.

Here are my references:
https://github.com/vitejs/vite/discussions/13171https://stackoverflow.com/questions/76290418/conditional-dynamic-imports-always-included-in-bundle-vite-svelte?utm_source=chatgpt.com

@sumeyyeKurtulus sumeyyeKurtulus changed the title Angular - Fixing the Vite builder warning error Angular - Fixing the Vite builder warning problem Feb 4, 2025
@ismcagdas ismcagdas merged commit 360a748 into rel-9.0 Feb 4, 2025
3 of 4 checks passed
@ismcagdas ismcagdas deleted the issue-21448 branch February 4, 2025 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants