wix-incubator / pro-gallery

Blazing fast & beautiful galleries built for the web
https://pro-gallery.surge.sh
MIT License
270 stars 37 forks source link

Consumer builds fail with esbuild #1246

Closed emilis-wix closed 1 month ago

emilis-wix commented 1 month ago

Our and our consumer builds fail with similar messages:

[14:10:54.200] ✘ [ERROR] Could not resolve "three/examples/jsm/loaders/GLTFLoader"
[14:10:54.200] 
[14:10:54.200]     ../../node_modules/pro-gallery/dist/esm/components/helpers/3dManager.js:3:27:
[14:10:54.200]       3 │ import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader';
[14:10:54.200]         ╵                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[14:10:54.200] 
[14:10:54.200]   The module "./examples/jsm/loaders/GLTFLoader" was not found on the file system:
[14:10:54.200] 
[14:10:54.200]     ../../node_modules/three/package.json:14:24:
[14:10:54.200]       14 │     "./examples/jsm/*": "./examples/jsm/*",
[14:10:54.200]          ╵                         ~~~~~~~~~~~~~~~~~~
[14:10:54.200] 
[14:10:54.200]   Import from "three/examples/jsm/loaders/GLTFLoader.js" to get the file "../../node_modules/three/examples/jsm/loaders/GLTFLoader.js":
[14:10:54.200] 
[14:10:54.200]     ../../node_modules/pro-gallery/dist/esm/components/helpers/3dManager.js:3:65:
[14:10:54.200]       3 │ import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader';
[14:10:54.200]         │                                                                  ^
[14:10:54.200]         ╵                                                                  .js
[14:10:54.200] 
[14:10:54.200]   You can mark the path "three/examples/jsm/loaders/GLTFLoader" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle.
[14:10:54.200] 
[14:10:54.209] ✘ [ERROR] Could not resolve "three/examples/jsm/loaders/DRACOLoader"
[14:10:54.209] 
[14:10:54.209]     ../../node_modules/pro-gallery/dist/esm/components/helpers/3dManager.js:4:28:
[14:10:54.209]       4 │ import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader';
[14:10:54.209]         ╵                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[14:10:54.209] 
[14:10:54.209]   The module "./examples/jsm/loaders/DRACOLoader" was not found on the file system:
[14:10:54.209] 
[14:10:54.210]     ../../node_modules/three/package.json:14:24:
[14:10:54.210]       14 │     "./examples/jsm/*": "./examples/jsm/*",
[14:10:54.210]          ╵                         ~~~~~~~~~~~~~~~~~~
[14:10:54.210] 
[14:10:54.210]   Import from "three/examples/jsm/loaders/DRACOLoader.js" to get the file "../../node_modules/three/examples/jsm/loaders/DRACOLoader.js":
[14:10:54.210] 
[14:10:54.210]     ../../node_modules/pro-gallery/dist/esm/components/helpers/3dManager.js:4:67:
[14:10:54.210]       4 │ import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader';
[14:10:54.210]         │                                                                    ^
[14:10:54.210]         ╵                                                                    .js
[14:10:54.210] 
[14:10:54.210]   You can mark the path "three/examples/jsm/loaders/DRACOLoader" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle.
[14:10:54.210] 
[14:10:54.217] ✘ [ERROR] Could not resolve "three/examples/jsm/controls/OrbitControls"
[14:10:54.217] 
[14:10:54.217]     ../../node_modules/pro-gallery/dist/esm/components/helpers/3dManager.js:5:30:
[14:10:54.217]       5 │ ...{ OrbitControls } from 'three/examples/jsm/controls/OrbitControls';
[14:10:54.217]         ╵                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[14:10:54.217] 
[14:10:54.217]   The module "./examples/jsm/controls/OrbitControls" was not found on the file system:
[14:10:54.217] 
[14:10:54.217]     ../../node_modules/three/package.json:14:24:
[14:10:54.217]       14 │     "./examples/jsm/*": "./examples/jsm/*",
[14:10:54.217]          ╵                         ~~~~~~~~~~~~~~~~~~
[14:10:54.217] 
[14:10:54.217]   Import from "three/examples/jsm/controls/OrbitControls.js" to get the file "../../node_modules/three/examples/jsm/controls/OrbitControls.js":
[14:10:54.217] 
[14:10:54.217]     ../../node_modules/pro-gallery/dist/esm/components/helpers/3dManager.js:5:72:
[14:10:54.217]       5 │ ...{ OrbitControls } from 'three/examples/jsm/controls/OrbitControls';
[14:10:54.217]         │                                                                     ^
[14:10:54.217]         ╵                                                                     .js
[14:10:54.217] 
[14:10:54.217]   You can mark the path "three/examples/jsm/controls/OrbitControls" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle.
[14:10:54.217] 
[14:10:54.234] ✘ [ERROR] Could not resolve "three/examples/jsm/loaders/RGBELoader"
[14:10:54.234] 
[14:10:54.234]     ../../node_modules/pro-gallery/dist/esm/components/helpers/3dManager.js:155:60:
[14:10:54.234]       155 │ ... "three-rbdl-loader" */ 'three/examples/jsm/loaders/RGBELoader');
[14:10:54.235]           ╵                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[14:10:54.235] 
[14:10:54.235]   The module "./examples/jsm/loaders/RGBELoader" was not found on the file system:
[14:10:54.235] 
[14:10:54.235]     ../../node_modules/three/package.json:14:24:
[14:10:54.235]       14 │     "./examples/jsm/*": "./examples/jsm/*",
[14:10:54.235]          ╵                         ~~~~~~~~~~~~~~~~~~
[14:10:54.235] 
[14:10:54.235]   Import from "three/examples/jsm/loaders/RGBELoader.js" to get the file "../../node_modules/three/examples/jsm/loaders/RGBELoader.js":
[14:10:54.235] 
[14:10:54.235]     ../../node_modules/pro-gallery/dist/esm/components/helpers/3dManager.js:155:98:
[14:10:54.235]       155 │ ... "three-rbdl-loader" */ 'three/examples/jsm/loaders/RGBELoader');
[14:10:54.235]           │                                                                  ^
[14:10:54.235]           ╵                                                                  .js
[14:10:54.235] 
[14:10:54.235]   You can mark the path "three/examples/jsm/loaders/RGBELoader" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle. You can also add ".catch()" here to handle this failure at run-time instead of bundle-time.

The imports from Three.js in this file seem to be the problem.

Out of the 5 three/examples/... imports 4 fail.

The one that is NOT failing has .js at the end of the import path.

In at least one of the cases we noticed, esbuild was used as the bundler.