question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tree Shaking scene loader problem

See original GitHub issue

When importing SceneLoader directly from import { SceneLoader } from '@babylonjs/core/Loading/sceneLoader';

an exception is thrown:

TypeError: Cannot read property 'plugin' of undefined
    at Function.SceneLoader._loadData (sceneLoader.ts:364)
    at Function.SceneLoader.ImportMesh (sceneLoader.ts:602)
    at sceneLoader.ts:644
    at new Promise (<anonymous>)
    at Function.SceneLoader.ImportMeshAsync (sceneLoader.ts:643)
    at AssetsManager._callee$ (assetsManager.ts:5)
    at tryCatch (runtime.js:62)
    at Generator.invoke [as _invoke] (runtime.js:288)
// ...

importing SceneLoader like import { SceneLoader } from '@babylonjs/core/Loading'; fix the problem.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
kutomercommented, Jan 15, 2019

O.K changed to:

import '@babylonjs/core/Loading/Plugins/babylonFileLoader';
import { SceneLoader } from '@babylonjs/core/Loading/sceneLoader';

Thanks again.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error when using Parcel with tree shaking - Questions
So I enabled tree shaking on ParcelJS, and I got this error when opening the .html ... import { Scene } from “@babylonjs/core/scene”;...
Read more >
Tree Shaking with webpack 3 doesn't work
I just upgraded webpack in my react project from version 1 to the latest (3.5.5). I followed the migration guide and there were...
Read more >
Tree Shaking
Clarifying tree shaking and sideEffects. The sideEffects and usedExports (more known as tree shaking) optimizations are two different things. sideEffects is ...
Read more >
Tree Shaking Three.js - Questions
Hello! I'm building a web app with Three.js. Our main focus is instance loading on the first visit of the user, therefore I...
Read more >
Code-Splitting
This ensures that tree shaking keeps working and that you don't pull in unused components. // ManyComponents.js export const MyComponent = /* ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found