Jump to content

I got errors with babylonjs.loaders.module.d.ts with 3.2.0-beta.3


BlackMojito
 Share

Recommended Posts

Hi, this is a missing typing file that needs to be imported from the already-installed package "babylonjs-gltf2interface". 

After importing the loaders module, enter the following import:

import "babylonjs-gltf2interface";

This will load the right declarations

You can also load it in the typing section in your tsconfig.

I still need to find a good way to load it automatically without you needing to manually load it.

Link to comment
Share on other sites

9 hours ago, RaananW said:

Hi, this is a missing typing file that needs to be imported from the already-installed package "babylonjs-gltf2interface". 

After importing the loaders module, enter the following import:

import "babylonjs-gltf2interface";

This will load the right declarations

You can also load it in the typing section in your tsconfig.

I still need to find a good way to load it automatically without you needing to manually load it.

Adding it to the typings seems not to work either...

image.thumb.png.fe0d06fc62df8d73646f458a077b4f85.png

Link to comment
Share on other sites

9 hours ago, RaananW said:

Hi, this is a missing typing file that needs to be imported from the already-installed package "babylonjs-gltf2interface". 

After importing the loaders module, enter the following import:

import "babylonjs-gltf2interface";

This will load the right declarations

You can also load it in the typing section in your tsconfig.

I still need to find a good way to load it automatically without you needing to manually load it.

But why it worked with beta.1...

Link to comment
Share on other sites

It worked due to s line I removed from the generated declaration of all modules. I'll probably reinstate this line in a different way.

I assume you use webpack and not only typescript in your project? This is probably why you still get the error. Add this line to your index, after loading the loaders package, I'll update here when it changes.

Link to comment
Share on other sites

5 hours ago, RaananW said:

It worked due to s line I removed from the generated declaration of all modules. I'll probably reinstate this line in a different way.

I assume you use webpack and not only typescript in your project? This is probably why you still get the error. Add this line to your index, after loading the loaders package, I'll update here when it changes.

OK

Link to comment
Share on other sites

What package were you installing that is missing this?

The gltf2 interface package is a dependency (https://github.com/BabylonJS/Babylon.js/blob/master/dist/preview release/loaders/package.json) and must be installed when you install the loaders package. If it wasn't installed it would be great to know what package manager and what version of it you are using.

Link to comment
Share on other sites

Here is my settings on package.json related to bjs:

I am using npm version 5.6.0. So I made sure the gltf2interface package is actually installed.

  "dependencies": {
    "babylonjs": "3.2.0-beta.3",
    "babylonjs-gui": "3.2.0-beta.3",
    "babylonjs-inspector": "3.2.0-beta.3",
    "babylonjs-loaders": "3.2.0-beta.3",
    "babylonjs-materials": "3.2.0-beta.3",
    "babylonjs-post-process": "3.2.0-beta.3",
    "babylonjs-serializers": "3.2.0-beta.3",
    "babylonjs-gltf2interface": "3.2.0-beta.3",
    "babylonjs-procedural-textures": "3.2.0-beta.3",

The top of my .ts file looks like the following:

import 'babylonjs'
import 'babylonjs-gltf2interface'
import 'babylonjs-loaders'

When compiling, I am getting the following.(The build was done via angular cli)

Note that things were building fine in beta.1.  I did not try beta.2.

Date: 2018-03-27T18:35:07.808Z
Hash: 3686eed3bb451661e5f1
Time: 4884ms
chunk {0} styles.0744b9f6769c326ccd7f.bundle.css (styles) 0 bytes [initial] [rendered]
chunk {1} polyfills.addd7ef0ff7c1f7ee875.bundle.js (polyfills) 84 bytes [initial] [rendered]
chunk {2} main.347f8286efa7b916720e.bundle.js (main) 86 bytes [initial] [rendered]
chunk {3} inline.318b50c57b4eba3d437b.bundle.js (inline) 796 bytes [entry] [rendered]

ERROR in node_modules/babylonjs-loaders/babylonjs.loaders.module.d.ts(854,39): error TS2304: Cannot find name 'IAccessor'.
node_modules/babylonjs-loaders/babylonjs.loaders.module.d.ts(857,47): error TS2304: Cannot find name 'IAnimationChannel'.
node_modules/babylonjs-loaders/babylonjs.loaders.module.d.ts(861,24): error TS2304: Cannot find name 'AnimationSamplerInterpolation'.
node_modules/babylonjs-loaders/babylonjs.loaders.module.d.ts(864,47): error TS2304: Cannot find name 'IAnimationSampler'.
node_modules/babylonjs-loaders/babylonjs.loaders.module.d.ts(867,40): error TS2304: Cannot find name 'IAnimation'.
node_modules/babylonjs-loaders/babylonjs.loaders.module.d.ts(872,37): error TS2304: Cannot find name 'IBuffer'.
node_modules/babylonjs-loaders/babylonjs.loaders.module.d.ts(875,41): error TS2304: Cannot find name 'IBufferView'.
node_modules/babylonjs-loaders/babylonjs.loaders.module.d.ts(878,37): error TS2304: Cannot find name 'ICamera'.
node_modules/babylonjs-loaders/babylonjs.loaders.module.d.ts(880,36): error TS2304: Cannot find name 'IImage'.
node_modules/babylonjs-loaders/babylonjs.loaders.module.d.ts(883,39): error TS2304: Cannot find name 'IMaterial'.
node_modules/babylonjs-loaders/babylonjs.loaders.module.d.ts(892,35): error TS2304: Cannot find name 'IMesh'.
node_modules/babylonjs-loaders/babylonjs.loaders.module.d.ts(895,44): error TS2304: Cannot find name 'IMeshPrimitive'.
node_modules/babylonjs-loaders/babylonjs.loaders.module.d.ts(897,35): error TS2304: Cannot find name 'INode'.
node_modules/babylonjs-loaders/babylonjs.loaders.module.d.ts(910,38): error TS2304: Cannot find name 'ISampler'.
node_modules/babylonjs-loaders/babylonjs.loaders.module.d.ts(913,36): error TS2304: Cannot find name 'IScene'.
node_modules/babylonjs-loaders/babylonjs.loaders.module.d.ts(915,35): error TS2304: Cannot find name 'ISkin'.
node_modules/babylonjs-loaders/babylonjs.loaders.module.d.ts(919,38): error TS2304: Cannot find name 'ITexture'.
node_modules/babylonjs-loaders/babylonjs.loaders.module.d.ts(921,35): error TS2304: Cannot find name 'IGLTF'.
node_modules/babylonjs-loaders/babylonjs.loaders.module.d.ts(1022,57): error TS2304: Cannot find name 'ITextureInfo'.
node_modules/babylonjs-loaders/babylonjs.loaders.module.d.ts(1059,93): error TS2304: Cannot find name 'IProperty'.

 

Link to comment
Share on other sites

This seems to be an issue with the way angular loads typings from loaded packages, but this is just an uneducated guess.

I have pushed a few changes today that will reinstate the dependencies between declarations. If you want to make sure the next version will work, you can load the latest PR https://github.com/BabylonJS/Babylon.js/issues/4024 and use those declaration files and see if it compiles correctly (the simplest hack would be to change them in your node_modules).

This will be in beta.4 if all tests are successful.

Link to comment
Share on other sites

@RaananW thanks for looking into this.

Angular actually uses webpack for loading modules stuff, so I am afraid this issue will appear on other webpack-based builds (?) 

I confirmed this issue started to happen since beta.2. My build worked fine on previous bjs npm packages including beta.1.

I will try the PR you mentioned above, I just simply copy over the definition files right ?

Link to comment
Share on other sites

 

Yep, copy and keep me posted. Thanks!

Oh, and I know angular uses webpack ?

I also know I'm testing every release with webpack (and others). So, my uneducated guess is still my uneducated guess. I'll try finding out why angular doesn't like typing-only packages.

Link to comment
Share on other sites

Hi @HoloLite, did you check?

I just initialized a new angular project and check old vs. new - old doesn't work, as you said, but the new one compiled correctly. I ejected webpack.config and configured the externals, but those were only warnings. Other than that I get angular compiled now. Would be great to know if you have the same experience before I push a new npm package

Link to comment
Share on other sites

Sorry too much stuff to take care yesterday. Just got up this morning. Will be on my way to the office to work on this. 

If you don't mind, go ahead push the fix you made. I trust your fix is good as always in the past. It will take me about 2 or 3 hrs from now to test the changes if you have to wait. 

Link to comment
Share on other sites

Ok so here is what I do:

1. npm install the beta.3
2. copied over some of the latest .d.ts files onto my local node_modules folder.

Initially I got more errors than before, then I decided to copy only the babylonjs.loaders.module.d.ts, and this builds fine with some warning though.

During runtime, I do got lots of errors. I guess this is due to my out-of-sync package state. I guess I did not copy the right set of def files ?

But as far as proving that the build break has been fixed, is this sufficient ?

Link to comment
Share on other sites

I wonder what the errors were, but for the sake of this test, it seems like it went fine. If you didn't get compile errors then this was fixed.

What I did to compile angular error-free was to copy only the new declaration files of both the loaders and the gltf2interface (which now has the module defined, just to be sure). 

Link to comment
Share on other sites

So I redid the steps again and apparently copying the .d.ts are not sufficient to test the runtime. I guess this is obvious.

So after copying the needed .js and .ts files for babylonjs, loader and the gltf2interface npm packages, the app runs fine, no error.

I still got the warning messages when building, I guess I can ignore this. If you are curious here are the warning:

> [email protected] build D:\dev\projects\webapps\hololite.github.io\src\VkTemplate
> ng build --prod --base-href "/VkTemplate/"

Date: 2018-03-29T20:55:52.738Z
Hash: 6f566eeaa016171e2154
Time: 96063ms
chunk {0} polyfills.a160e45de3d43a03f025.bundle.js (polyfills) 59.4 kB [initial] [rendered]
chunk {1} main.88dffbbcedaf9281f96c.bundle.js (main) 2.86 MB [initial] [rendered]
chunk {2} styles.9c0ad738f18adc3d19ed.bundle.css (styles) 79 bytes [initial] [rendered]
chunk {3} inline.9d99a65b48a46253e07d.bundle.js (inline) 1.45 kB [entry] [rendered]

WARNING in ./node_modules/babylonjs/babylon.js
Module not found: Error: Can't resolve 'earcut' in 'D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\node_modules\babylonjs'
resolve 'earcut' in 'D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\node_modules\babylonjs'
  Parsed request is a module
  using description file: D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\node_modules\babylonjs\package.json (relative path: .)
    Field 'browser' doesn't contain a valid alias configuration
  after using description file: D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\node_modules\babylonjs\package.json (relative path: .)
    resolve as module
      D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\node_modules\babylonjs\node_modules doesn't exist or is not a directory
      D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\node_modules\node_modules doesn't exist or is not a directory
      D:\dev\projects\webapps\hololite.github.io\src\node_modules doesn't exist or is not a directory
      D:\dev\projects\webapps\hololite.github.io\node_modules doesn't exist or is not a directory
      D:\dev\projects\webapps\node_modules doesn't exist or is not a directory
      D:\dev\projects\node_modules doesn't exist or is not a directory
      D:\dev\node_modules doesn't exist or is not a directory
      D:\node_modules doesn't exist or is not a directory
      looking for modules in D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\node_modules
        using description file: D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\package.json (relative path: ./node_modules)
          Field 'browser' doesn't contain a valid alias configuration
        after using description file: D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\package.json (relative path: ./node_modules)
          using description file: D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\package.json (relative path: ./node_modules/earcut)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\node_modules\earcut doesn't exist
            .ts
              Field 'browser' doesn't contain a valid alias configuration
              D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\node_modules\earcut.ts doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\node_modules\earcut.js doesn't exist
            as directory
              D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\node_modules\earcut doesn't exist
      looking for modules in D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\node_modules
        using description file: D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\package.json (relative path: ./node_modules)
          Field 'browser' doesn't contain a valid alias configuration
        after using description file: D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\package.json (relative path: ./node_modules)
          using description file: D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\package.json (relative path: ./node_modules/earcut)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\node_modules\earcut doesn't exist
            .ts
              Field 'browser' doesn't contain a valid alias configuration
              D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\node_modules\earcut.ts doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\node_modules\earcut.js doesn't exist
            as directory
              D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\node_modules\earcut doesn't exist
      looking for modules in D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\ClientApp
        using description file: D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\package.json (relative path: ./ClientApp)
          Field 'browser' doesn't contain a valid alias configuration
        after using description file: D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\package.json (relative path: ./ClientApp)
          using description file: D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\package.json (relative path: ./ClientApp/earcut)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\ClientApp\earcut doesn't exist
            .ts
              Field 'browser' doesn't contain a valid alias configuration
              D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\ClientApp\earcut.ts doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\ClientApp\earcut.js doesn't exist
            as directory
              D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\ClientApp\earcut doesn't exist
      looking for modules in D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\ClientApp
        using description file: D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\package.json (relative path: ./ClientApp)
          Field 'browser' doesn't contain a valid alias configuration
        after using description file: D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\package.json (relative path: ./ClientApp)
          using description file: D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\package.json (relative path: ./ClientApp/earcut)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\ClientApp\earcut doesn't exist
            .ts
              Field 'browser' doesn't contain a valid alias configuration
              D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\ClientApp\earcut.ts doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\ClientApp\earcut.js doesn't exist
            as directory
              D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\ClientApp\earcut doesn't exist
      looking for modules in D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\ClientApp
        using description file: D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\package.json (relative path: ./ClientApp)
          Field 'browser' doesn't contain a valid alias configuration
        after using description file: D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\package.json (relative path: ./ClientApp)
          using description file: D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\package.json (relative path: ./ClientApp/earcut)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\ClientApp\earcut doesn't exist
            .ts
              Field 'browser' doesn't contain a valid alias configuration
              D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\ClientApp\earcut.ts doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\ClientApp\earcut.js doesn't exist
            as directory
              D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\ClientApp\earcut doesn't exist
      looking for modules in D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\ClientApp
        using description file: D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\package.json (relative path: ./ClientApp)
          Field 'browser' doesn't contain a valid alias configuration
        after using description file: D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\package.json (relative path: ./ClientApp)
          using description file: D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\package.json (relative path: ./ClientApp/earcut)
            no extension
              Field 'browser' doesn't contain a valid alias configuration
              D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\ClientApp\earcut doesn't exist
            .ts
              Field 'browser' doesn't contain a valid alias configuration
              D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\ClientApp\earcut.ts doesn't exist
            .js
              Field 'browser' doesn't contain a valid alias configuration
              D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\ClientApp\earcut.js doesn't exist
            as directory
              D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\ClientApp\earcut doesn't exist
[D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\node_modules\babylonjs\node_modules]
[D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\node_modules\node_modules]
[D:\dev\projects\webapps\hololite.github.io\src\node_modules]
[D:\dev\projects\webapps\hololite.github.io\node_modules]
[D:\dev\projects\webapps\node_modules]
[D:\dev\projects\node_modules]
[D:\dev\node_modules]
[D:\node_modules]
[D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\node_modules\earcut]
[D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\node_modules\earcut.ts]
[D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\node_modules\earcut.js]
[D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\node_modules\earcut]
[D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\node_modules\earcut]
[D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\node_modules\earcut.ts]
[D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\node_modules\earcut.js]
[D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\node_modules\earcut]
[D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\ClientApp\earcut]
[D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\ClientApp\earcut.ts]
[D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\ClientApp\earcut.js]
[D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\ClientApp\earcut]
[D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\ClientApp\earcut]
[D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\ClientApp\earcut.ts]
[D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\ClientApp\earcut.js]
[D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\ClientApp\earcut]
[D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\ClientApp\earcut]
[D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\ClientApp\earcut.ts]
[D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\ClientApp\earcut.js]
[D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\ClientApp\earcut]
[D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\ClientApp\earcut]
[D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\ClientApp\earcut.ts]
[D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\ClientApp\earcut.js]
[D:\dev\projects\webapps\hololite.github.io\src\VkTemplate\ClientApp\earcut]
 @ ./node_modules/babylonjs/babylon.js 17:17-34
 @ ./ClientApp/app/Basic/BasicMaterials.ts
 @ ./ClientApp/app/PlaygroundDirector.ts
 @ ./ClientApp/app/PlaygroundApp.ts
 @ ./ClientApp/app/app.component.ts
 @ ./ClientApp/app/app.module.ngfactory.js
 @ ./ClientApp/main.ts
 @ multi ./ClientApp/main.ts

 

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