Sign in to follow this  
Jan23

NPM / Webpack and loaders

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

Share this post


Link to post
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 :-)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.