EdgeRenderer side-effect, es6 modules and TreeShaking error
See original GitHub issueIf 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:
- Created 4 years ago
- Comments:5 (5 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fixed by adding the error message
another workaround is to import the file directly :
import '@babylonjs/core/Rendering/edgesRenderer'