Jump to content

Uncaught ReferenceError: BABYLON is not defined


max123
 Share

Recommended Posts

4 minutes ago, RaananW said:

3.2 has moved to UMD, and has a proper amd definition. you can now require babylonjs as a package. 

How did you load it until now? using externals?

requirejs(["pep", "babylon", this.settingsFile]...

Worked great... until now.

Babylon is a small part of the project I'm working on and is loaded via requirejs at runtime when needed.

Link to comment
Share on other sites

@RaananW, it's defined in the main.js file like following:

requirejs.config({
   shim: {
      easeljs: {
         exports: 'createjs'
      },
      tweenjs: {
         deps: ['easeljs'],
         exports: 'Tween'
      },
      movieclip: {
         deps: ['easeljs', 'tweenjs']
      },
      babylon: {
         exports: "BABYLON"
      },
      pep: {
         deps: ["babylon"]
      }



   },
   paths: {
      createjs: 'libs/createjs-2015.11.26.min',
           "pdfjs-dist": "libs/pdf/pdfjs-dist",
           babylon: "libs/3d/babylon/babylon",
           pep: "libs/3d/babylon/pep",
   }
});
Link to comment
Share on other sites

Hi @RaananW, thanks for the heads up. I've managed to load 3.2. Here's the requirejs definition (I did keep the shim as to make sure PEP is loaded and available to Babylon first):

 

requirejs.config({
   shim: {
      babylonjs: {
         exports: "BABYLON"
      },
      pep: {
         deps: ["babylonjs"]
      }
   },
   paths: {
           babylonjs: "libs/3d/babylon/babylon",
           pep: "libs/3d/babylon/pep",
   }
});

Hop this helps to whoever has problems with BJS 3.2 and AMD (requirejs).

Note:  I've changed babylon to babylonjs.

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