Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global d3 object is overwritten #29

Closed
vprus opened this issue Sep 1, 2017 · 3 comments
Closed

Global d3 object is overwritten #29

vprus opened this issue Sep 1, 2017 · 3 comments

Comments

@vprus
Copy link

vprus commented Sep 1, 2017

As of release 1.0.6, d3-dsv has this at the top:

(function (global, factory) {
    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
    typeof define === 'function' && define.amd ? define(['exports'], factory) :
    (factory((global.d3 = {})));
}(this, (function (exports) { 'use strict';`

The effect is that global.d3 is reset, removing anything that previously loaded modules put there. All the other modules have global.d3 = global.d3 || {}

The problem is present both in d3-dsv.zip for version 1.0.6 on github, and in https://d3js.org/d3-dsv.v1.js

@curran
Copy link
Contributor

curran commented Sep 1, 2017

Perhaps it's to do with the Rollup upgrade in this commit ad89faa, which changed it from 0.41 to 0.49.

Looking through the Rollup CHANGELOG, I think the culprit is this change from 0.44:

[BREAKING] Don't extend existing globals, unless options.extend is true.

Discussion of this feature is in rollup/rollup#827

It looks like this can be fixed by setting Rollup's options.extend to true.

@mbostock
Copy link
Member

mbostock commented Sep 1, 2017

Sorry about this! I forgot about this change when upgrading Rollup.

@vprus
Copy link
Author

vprus commented Sep 1, 2017

Thanks for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants