Jump to content

NPM / Webpack and loaders


Jan23
 Share

Recommended Posts

Hi there,

 

using Angular I have problems loading gltf-files. Now, I think I've narrowed as loading a Babylon file (*.babylon) works fine. Also, loading a gltf file in a simple non-webpack project works fine as well.

The issue is (probably) that the gltf-loader is not loaded by webpack. I've found this issue (https://github.com/BabylonJS/Babylon.js/issues/2265) but I still can't get it working.

 

So, how do I integrate the loaders using webpack?

 

Thanks and cheers,

 

Jan

Link to comment
Share on other sites

OK, as a workaround I'm using the bundled files, which I've copied in the assets directory in a newly created js directory:

  <script src="assets/js/babylon.max.js"></script>
  <script src="assets/js/babylon.glTFFileLoader.min.js"></script>

Then to use it in Angular (Typescript) I've just copied (appended) the whole content of the babylon.d.ts into the typings.d.ts file which is located at the project root directory and is created by the Angular CLI. If you're not using Angular or Angular with the CLI you can place your custom typings whereever you wish but need to specify the location in the tsconfig.json.

 

Loading works! Now, I only need to figure out, how to set the camera to acutally see my models :-) ... but that's the fun part, I hope :-)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...