Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jul 29, 2019. It is now read-only.
This repository was archived by the owner on Jul 29, 2019. It is now read-only.

Mix of ES6 imports and common.js exports lead to problems with bundling. #2934

@AoDev

Description

@AoDev

The problem
In some cases, in particular with WebPack, it is not possible to bundle a specific component, like the timeline only for example.

Error that will pop up
TypeError: Cannot assign to read only property 'exports' of object '#<Object>'

Relevant discussions: Webpack issue #4039
Vis is even mentioned in the comments

Some examples in vis code
Timeline line 18 using ES6 import
Timeline line 591 exports as common.js

What should be done
The simple rule is: never mix ES6 with commonjs import/export in the same file. It can work sometimes but just don't take the chance, a few problems can be avoided simply by following this rule. For example resolution of circular dependencies.

Related: There is currently a discussion about linting / code style / ES6, etc where this is particularly relevant as the linter should not allow such mix.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions