Import the extension module into node

I have a Node.js Angular application that I am trying to import babylon.js into.

Current setting

1) npm install --save babylonjsto get npm update in my node projects.

The following figure shows the npm rep folder structure. enter image description here

2) In my Angular component, I import the BABYLON declaration from the files babylon.module.d.tsand babylon.max.jsin the above image.

import * as BABYLON from 'babylon.js'

Babylonjs now works great, has a typing and that's it, so I can use BABYLON as shown below enter image description here

Problem

None of the included extensions are connected. These extensions are located in the following folders

(The full folder structure is in the first image. I left the gui folder open, as this is the specific extension I'm trying to activate at this time)

enter image description here

babylon.module.d.ts BABYLON :

declare module BABYLON { //class types are defined in here }

gui ( ) BABYLON :

declare module BABYLON.GUI { //extend classes & create new classes in here in here }

1) babylon.gui.d.ts BABYLON.GUI,

import * as BABYLON from 'babylonjs';
import * as BABYLON.GUI from 'babylonjs/dist/preview release/gui/babylon.gui';

Typescript: Duplicate identifier 'BABYLON', , BABYLON.GUI is how the babylon.gui.d.ts` .

2) CDN index.html. , , . , CDN . <head> . .

3) babylon.gui.d.ts babylon.module.d.ts. BABYLON.GUI` - undefined.

npm , npm .

4) BABYLON , .

- , ?

PS. , , node, babylon.js !

+4
1

deltakosh .

:

  • npm
  • node
  • , .
  • , .

- github, .

Babylon, , :

CDN babylon

typescript, .ts declare let BABYLON: any;. babylon , .

, !

0

Source: https://habr.com/ru/post/1681922/


All Articles