visjs/vis-data

Release 7.1.1 breaks Storybook / Webpack 4

tomsontom opened this issue · 5 comments

We tried to update to release 7.1.1 and get the following webpack error when trying to build our storybook-sample

ERROR in .../node_modules/vis-data/esnext/esm/vis-data.js 1239:29
Module parse failed: Unexpected token (1239:29)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|             if (id != null) {
|                 // a single item
>                 return item ?? null;
|             }
|             else {

The reason is that webpack 4 does support this ES2020 syntax.

I'm also getting this error and I'm not even using story book. My react app just wont' compile

You should import vis-data/peer if you don't have ESNext transpiler. vis-data/esnext is for people who want to transpile and polyfill on their own.

thanks I'll give that a shot tomorrow when in office but most likely that fixes my problem

so how you solve this error? i am using vis-data/esnext like
import { DataSet } from 'vis-data/esnext'
and i got same error

Module parse failed: Unexpected token (1437:21)
File was processed with these loaders:
 * ./node_modules/react-scripts/node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
|       if (id != null) {
|         // a single item
>         return item ?? null;
|       } else {
|         // just return our array

need to upgrade webpack or something else?

Use import {DataSet} from 'vis-data/peer' as mentioned by @Thomaash.