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

Facilitate erdblick web deployment #101

Merged
merged 4 commits into from
Mar 28, 2024
Merged

Facilitate erdblick web deployment #101

merged 4 commits into from
Mar 28, 2024

Conversation

josephbirkner
Copy link
Collaborator

@josephbirkner josephbirkner commented Mar 25, 2024

The ESM Cesium Module, which is used by default with Typescript/Webpack, has over 100 worker source files outside of the cesium sources. Loading these creates a load of overhead and load balancing throttling on viewer.nds.live. By switching to the non-ESM sources, we can take advantage of the inlined worker sources in the Cesium.js bundle. This has the added benefit of reducing load times. See CesiumGS/cesium#11519

Closes #102

@ashley-mort
Copy link

ashley-mort commented Mar 26, 2024

@josephbirkner Is there something like this that can be done to the native Cesium repo build to get the workers inlined into the build that can be imported as ESM?

Apologies for the question as I'm new to the javascript bundlers and all their configurations.

I tried building this repo with npm install and npm run build but get errors like:

./erdblick_app/app/app.component.ts:4:0-68 - Error: Module not found: Error: Can't resolve '../../build/libs/core/erdblick-core' in 'D:\CesiumTest\erdblick-switch-cesium-build\erdblick_app\app'

Error: erdblick_app/app/app.component.ts:6:70 - error TS2307: Cannot find module '../../build/libs/core/erdblick-core' or its corresponding type declarations.

6 import MainModuleFactory, {Feature, MainModule as ErdblickCore} from '../../build/libs/core/erdblick-core';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

…tile requests. Do not abort and re-request the same set tiles.
@josephbirkner josephbirkner changed the title Switch Cesium build to the non-ES-module version Facilitate erdblick web deployment Mar 27, 2024
@josephbirkner
Copy link
Collaborator Author

josephbirkner commented Mar 27, 2024

@josephbirkner Is there something like this that can be done to the native Cesium repo build to get the workers inlined into the build that can be imported as ESM?

Apologies for the question as I'm new to the javascript bundlers and all their configurations.

I tried building this repo with npm install and npm run build but get errors like:

./erdblick_app/app/app.component.ts:4:0-68 - Error: Module not found: Error: Can't resolve '../../build/libs/core/erdblick-core' in 'D:\CesiumTest\erdblick-switch-cesium-build\erdblick_app\app'

Error: erdblick_app/app/app.component.ts:6:70 - error TS2307: Cannot find module '../../build/libs/core/erdblick-core' or its corresponding type declarations.

6 import MainModuleFactory, {Feature, MainModule as ErdblickCore} from '../../build/libs/core/erdblick-core'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Hi Ashely, yes, I think our solution will also work for you. Building Erdblick can be done by following these instructions. Erdblick uses cmake and emscripten to compile its core library to web assembly, hence the errors you are seeing.

@ashley-mort
Copy link

ashley-mort commented Mar 27, 2024

@josephbirkner Is there something like this that can be done to the native Cesium repo build to get the workers inlined into the build that can be imported as ESM?
Apologies for the question as I'm new to the javascript bundlers and all their configurations.
I tried building this repo with npm install and npm run build but get errors like:
./erdblick_app/app/app.component.ts:4:0-68 - Error: Module not found: Error: Can't resolve '../../build/libs/core/erdblick-core' in 'D:\CesiumTest\erdblick-switch-cesium-build\erdblick_app\app'
Error: erdblick_app/app/app.component.ts:6:70 - error TS2307: Cannot find module '../../build/libs/core/erdblick-core' or its corresponding type declarations.
6 import MainModuleFactory, {Feature, MainModule as ErdblickCore} from '../../build/libs/core/erdblick-core'; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Hi Ashely, yes, I think our solution will also work for you. Building Erdblick can be done by following these instructions. Erdblick uses cmake and emscripten to compile its core library to web assembly, hence the errors you are seeing.

Using cmake 3.25.3 (mac os):

-- Could NOT find PythonInterp (missing: PYTHON_EXECUTABLE)
CMake Error at build/_deps/cesiumnative-src/extern/draco/cmake/draco_emscripten.cmake:22 (message):
Python required for Emscripten builds, but cmake cannot find it.
Call Stack (most recent call first):
build/_deps/cesiumnative-src/extern/draco/cmake/draco_build_definitions.cmake:175 (draco_check_emscripten_environment)
build/_deps/cesiumnative-src/extern/draco/CMakeLists.txt:84 (draco_set_build_definitions)

@josephbirkner
Copy link
Collaborator Author

@ashley-mort I summarized our solution here: CesiumGS/cesium#11519 (comment)

That will probably be more helpful for you 🚀

@josephbirkner josephbirkner merged commit 75f971d into main Mar 28, 2024
1 check passed
@josephbirkner josephbirkner deleted the switch-cesium-build branch March 28, 2024 13:43
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

Successfully merging this pull request may close these issues.

Facilitate erdblick web deployment
3 participants