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.

EdgeRenderer side-effect, es6 modules and TreeShaking error

See original GitHub issue

If I Implement my IEdgesRenderer without using the existing EdgeRenderer, the file “Rendering/edgesRenderer.js” get stripped by webpack tree-shaking.

As a consequence, the side-effects in this file which adds enableEdgesRendering and disableEdgesRendering methods to the AbstractMesh class get stripped as well.

So trying to call enableEdgesRendering causes an exception this.mesh.enableEdgesRendering is not a function

You might think of a way to fix that if possible.

Workaround :

I can disable the tree-shaking for this file by adding this line : export class DisableTreeShaking extends EdgesRenderer {}

Issue Analytics

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

github_iconTop GitHub Comments

8reactions
sebavancommented, Apr 29, 2019

Fixed by adding the error message

1reaction
barroijcommented, Apr 26, 2019

another workaround is to import the file directly : import '@babylonjs/core/Rendering/edgesRenderer'

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tree Shaking - webpack
A "side effect" is defined as code that performs a special behavior when imported, other than exposing one or more exports. An example...
Read more >
Tree-shaking nested modules with webpack 4 - Stack Overflow
When I import only the Header component, the Button module is removed as expected, but my webpack bundle contains the ButtonGroup component.
Read more >
Tree shaking - The newline Guide to Creating a React Hooks ...
Tree shaking is the process of removing unused code from your bundle. ... In your module's package.json file set a property sideEffect to...
Read more >
Everything you never wanted to know about side effects
This means that the code cannot be tree-shaken away; it needs to run, because it changes things outside of the module that may...
Read more >
Dynamic Import, Code Splitting, Lazy Loading, and Error ...
When the module being imported has side effects, and those side effects can be avoided unless certain conditions happen. Example of Static ...
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