Lighthouse-io / react-visjs-timeline

React component for the vis.js timeline module
MIT License
210 stars 91 forks source link

Compiled vis.js bundle is imported #67

Open the-owl opened 5 years ago

the-owl commented 5 years ago

Overview

https://github.com/Lighthouse-io/react-visjs-timeline/blob/master/src/index.js#L1 This import includes a built vis.js bundle, with its own moment.js included. This increases output size and, most importantly, causes issues with moment.js locale configuration (because vis.js dist bundle uses its own copy of moment).

Package versions

react-visjs-timeline: 1.5.0 vis version: 4.21.0

Suggested fix

This is easily fixed by changing import from vis/dist/vis-timeline-graph2d.min to vis/index-timeline-graph2d.js. Currently I'm using a workaround via a webpack alias:

{
  resolve: {
    alias: {
      'vis/dist/vis-timeline-graph2d.min': 'vis/index-timeline-graph2d.js'
    }
  }
}

This solves my issue with moment.js locales.