Jump to content

ES6 import problem


Recommended Posts


if I use import { Engine } from "babylonjs"I get error that babylon.d.ts is not a model. Looks like that export = BABYLON is missing at the end of file. Could it be added or there  is reason why it is missing?

I saw this thread 

but looks like it still is missing in git

Link to comment
Share on other sites

@brianzinn Sure, what you wanted to know ?, I have Typescript + Webpack build. So Type definitions started to work out of the box from 3.0-alpha version of Babylon.

Import then:

import * as BABYLON from "babylonjs";

Works also with direct imports

import { Engine } from "babylonjs";

For webpack I needed to expose babylonjs as global var, for that I used expose-loader

Loader list of webpack:

   test: require.resolve("babylonjs"),
   loader: "expose-loader?BABYLON"


Link to comment
Share on other sites

{ test: require.resolve('babylonjs'), use: [{ loader: 'expose-loader', options: 'BABYLON' }]

Thanks. Slightly different syntax for webpack2.  Just wanted to see if having a project in Typescript + webpack would allow me to import the Canvas2D (import .. from 'babylonjs/canvas2d'), but it doesn't  Error is that it is not a module canvas2d.d.ts.  It was worth a try!  :) Cheers.

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.

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.


  • Recently Browsing   0 members

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