Jump to content

Install & Setup through npm?


agmcleod
 Share

Recommended Posts

Hi there,

I'm using babylon for a little prototype project, and I tried getting it through npm. It & cannonjs installed just fine, but pulling them in for a project leads to some issues. The inspector panel throws errors do to BABYLON not being global for example. I like having it through the package, as the tooling is better around it, VSCode autocomplete for example. For now i've just gone the route of including the script files.

Link to comment
Share on other sites

@Hersir Yep! Using webpack2 & yarn. I added the babylonjs and cannon packages as dependencies. At the entry file, i would have

 

import BABYLON from 'babylonjs'
import 'cannon'

The BABYLON instance seemed to work okay, but yeah things fell apart when it tries to load the inspector. As it expects BABYLON to be global. I suppose I could hoist it to WINDOW maybe, but that sounds not so smart ;)

 

Giving it another try this morning, seem to have trouble loading the physics plugin. The version I did with just injecting the script tag, is using a build i downloaded, which includes cannonjs. So not sure if I need to bootstrap that into Babylon somehow.

Link to comment
Share on other sites

Gave it a try, having both BABYLON & CANNON setup through the expose-loader seems to cause an infinite loop of rebuilds from webpack. I tried just putting in cannon, and removing my window hoist, but it doesn't seem to get found by babylon. May just keep my window hoist hack instead.

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...