model-viewer icon indicating copy to clipboard operation
model-viewer copied to clipboard

BetterVite support

Open AmitMY opened this issue 1 year ago • 2 comments

I have recently moved from Webpack to Vite (angular 18 was default webpack, now angular 19 is vite).

You might want to add vite-ignore next to your webpack ignore, or allow for static analysis otherwise:

3:10:35 PM [vite] warning: 
/Users/amitmoryossef/dev/sign/translate/.angular/cache/19.0.2/sign-translate/vite/deps/@google_model-viewer_lib_model-viewer.js
14309|          } = yield import(
14310|            /* webpackIgnore: true */
14311|            this.lottieLoaderUrl
   |            ^^^^^^^^^^^^^^^^^^^^
14312|          );
14313|          this._lottieLoader = new LottieLoader();
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.

  Plugin: vite:import-analysis
  File: /Users/amitmoryossef/dev/sign/translate/.angular/cache/19.0.2/sign-translate/vite/deps/@google_model-viewer_lib_model-viewer.js?v=de5cd189

AmitMY avatar Dec 11 '24 14:12 AmitMY

Good call - would you mind sending a PR? Since you're using Vite, you'll be able to test the fix better.

elalish avatar Dec 11 '24 16:12 elalish

I tested adding /* @vite-ignore */ next to /* webpackIgnore */ on line 57364 of model-viewer.js in /dist, which is in the getLottieLoader(withCredentials) function. It does correctly suppress the warning. I know it's /dist and all, but...

anders8 avatar Jan 20 '25 13:01 anders8