Skip to content

Babel/d3-array incompatibility issue in new Windows installs #779

@kayavila

Description

@kayavila

There seems to be an issue with babel/d3-array in fresh Windows installs. After creating an idyll article (and probably other types), trying to run idyll results in an unhandled error. This not an issue with idyll itself per se but may be impacting idyll users.

To Reproduce
Steps to reproduce the behavior:

  1. Download and install node.js from https://nodejs.org/en/download/
  2. Open a Node.js command prompt and update npm to the latest (8.6.0) - npm install -g npm@latest
  3. npm install -g idyll
  4. idyll create (use the defaults)
  5. cd my-idyll-post
  6. idyll

An error is thrown -


Building Idyll project with output directory: build

[BABEL] Note: The code generator has deoptimised the styling of "C:/Users/Kay/idyll/idyll-helloworld/node_modules/react-dom/cjs/react-dom.development.js" as it exceeds the max of "500KB".
node:events:504
      throw er; // Unhandled 'error' event
      ^

SyntaxError: C:/Users/Kay/idyll/idyll-helloworld/node_modules/d3-array/dist/d3-array.js: Only '=' operator can be used for specifying default value. (139:15)
  137 |   var sum = 0, index = 0;
  138 |   return Float64Array.from(values, valueof === undefined
> 139 |     ? v => (sum += +v || 0)
      |                ^
  140 |     : v => (sum += +valueof(v, index++, values) || 0));
  141 | }
  142 |

Environment

I had newly reformatted Windows 10 just a week or so ago, so it's a pretty clean environment. Idyll is being used for a class I'm attending, and about five of us in the class (all on Windows 10) ran into this same issue.

Installing the same in a new Ubuntu virtual machine does not throw an error. d3-array and babel (and idyll) versions were the same.

Additional context
As discussed in babel/babel#11038, updating cumsum in d3-array.js to use the function below instead is a workaround -

function cumsum(values, valueof) {
  var sum = 0,
    index = 0
  return Float64Array.from(
    values,
    valueof === undefined
      ? function (v) {
          return (sum += +v || 0)
        }
      : function (v) {
          return (sum += +valueof(v, index++, values) || 0)
        }
  )
}

Relevant links:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions