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

Include loaders for binary files like glb and wasm #10

Open
ggetz opened this issue Jun 11, 2018 · 7 comments
Open

Include loaders for binary files like glb and wasm #10

ggetz opened this issue Jun 11, 2018 · 7 comments

Comments

@ggetz
Copy link
Contributor

ggetz commented Jun 11, 2018

Brought up on the forum here: https://groups.google.com/forum/#!topic/cesium-dev/t463ShjMtEI

The new Draco wasm file needs to be loaded using a wasm loader.

Additionally, glb files and other binary files need to be loaded using an appropriate binary loader as well. Since it's so common to load these into a Cesium app, they should be included here.

@nmschulte
Copy link

I believe this is the same/related issue I was running into:
https://groups.google.com/d/msg/cesium-dev/TPSOorUDU2Y/VJv3SOktAAAJ

I am currently updating this project to use Webpack 4 and Cesium 1.46 to reproduce and diagnose the issue. Does that forum post identify a solution?

@nmschulte
Copy link

nmschulte commented Jun 12, 2018

I can no longer reproduce my issue with the latest versions of webpack (4.1.24.12.0) and various loaders (file-loader [0.11.21.1.11], url-loader [0.5.91.0.1]).

No matter if wasm-loader is in my "loader stack" (module loading rules; using oneOf w/ wasm-loader just before file-loader catch-all), this is what Webpack outputs

WARNING in ./node_modules/cesium/Source/ThirdParty/draco_decoder.wasm
Module parse failed: magic header not detected
You may need an appropriate loader to handle this file type.
Error: magic header not detected
    at new CompileError (/app/node_modules/@webassemblyjs/helper-api-error/lib/index.js:40:109)
    at parseModuleHeader (/app/node_modules/@webassemblyjs/wasm-parser/lib/decoder.js:288:13)
    at Object.decode (/app/node_modules/@webassemblyjs/wasm-parser/lib/decoder.js:1503:3)
    at decode (/app/node_modules/@webassemblyjs/wasm-parser/lib/index.js:234:21)
    at WebAssemblyParser.parse (/app/node_modules/webpack/lib/wasm/WebAssemblyParser.js:74:19)
    at doBuild.err (/app/node_modules/webpack/lib/NormalModule.js:462:32)
    at runLoaders (/app/node_modules/webpack/lib/NormalModule.js:344:12)
    at /app/node_modules/loader-runner/lib/LoaderRunner.js:370:3
    at iterateNormalLoaders (/app/node_modules/loader-runner/lib/LoaderRunner.js:211:10)
    at iterateNormalLoaders (/app/node_modules/loader-runner/lib/LoaderRunner.js:218:10)
    at /app/node_modules/loader-runner/lib/LoaderRunner.js:233:3
    at runSyncOrAsync (/app/node_modules/loader-runner/lib/LoaderRunner.js:130:11)
    at iterateNormalLoaders (/app/node_modules/loader-runner/lib/LoaderRunner.js:229:2)
    at Array.<anonymous> (/app/node_modules/loader-runner/lib/LoaderRunner.js:202:4)
    at Storage.finished (/app/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:43:16)
    at provider (/app/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:79:9)
 @ ./node_modules/cesium/Source/ThirdParty sync ^.\/.*$
 @ ./node_modules/cesium/Source/ThirdParty/xss.js
 @ ./node_modules/cesium/Source/Core/Credit.js
 @ ./node_modules/cesium/Source/Core/IonResource.js
 @ ./node_modules/cesium/Source/Core/createWorldTerrain.js
 @ ./src/index.js
 @ multi ./scripts/config/polyfills.js ./src/index.js

My application seems to run fine even with this warning. It is not using Draco, except unless the Ion provided terrain is using Draco.

Upgrading as I did required that I provide webpack with more heap space (node --max-old-space), and things take a bit longer to build, but it does work, even without wasm-loader.

@tkazik
Copy link

tkazik commented Dec 2, 2018

@nmschulte Would you mind sharing your webpack.config.js? I am currently getting the following error:

failed_to_load_model

Thank you!

@nmschulte
Copy link

nmschulte commented Dec 12, 2018

@nmschulte Would you mind sharing your webpack.config.js?

@tkazik I can share a portion if you know what you're interested in.

@Cronopaul
Copy link

Cronopaul commented May 1, 2019

Hallo, I downloaded the cesium-webpack-example and I have the following error:

cesium.js:14947 GET http://localhost:8080/ThirdParty/draco_decoder.wasm 404 (Not Found)

I can share a portion if you know what you're interested in.

Can you please share the part with the wasm loader?

@nmschulte
Copy link

Can you please share the part with the wasm loader?

@Cronopaul, I mitigated/resolved my issue by using a newer version of Webpack; Switching from Webpack v4.2.0 to Webpack v4.12.0 led to my comment here: #10 (comment)

To be clear, there is no wasm-loader in my Webpack config (webpack.config.js), I'm simply letting Webpack/file-loader handle these as they like.

@Cronopaul
Copy link

Thanks for your reply. I'm using Webpack v4.30.0.

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

No branches or pull requests

4 participants