-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
d3-selection dependency version issue with es6 #1823
Comments
Like I said in #1822, d3-collection is obsolete and incompatible with the latest D3. The correct solution does not involve installing d3-collection. The only workarounds that I can can think of from the top of my head involve modifying the file in question. (Specifically, deleting the offending import.) |
Sorry if the issue description was confusing but this actually doesn't have anything to do with d3-collection, maybe I shouldn't have mentioned the other issue. This is regarding d3-selection.
But I can't find a d3-selection version that exports those three. The automatically installed v2.0.0 doesn't have event and downgrading to v1.4.1 loses pointer instead. |
I see. It uses the same technique as the other issue, expecting to find But it refers to a different module, one which still exists but has different exports now. I guess rollup-generated code is more lenient then native ES6 in this regard. |
Yes I'm pretty sure the spec behavior is to fail hard, but it sounds like rollup can be configured to gracefully fail. How about designing the code for a d3@6 environment and then including a compat-layer completely separate, only used in d3@5 (and lower?) contexts? I would propose to evaluate something like registering a dcjs namespace in globalThis and optionally registering things like adaptHandlers or nestHandlers there to override behavior. In the library you'd then check for those handlers and use if specified, otherwise default to latest (v6) behavior. What do you think? |
Ah sorry, realized you have dc.config, which would make more sense than globalThis. |
The rollup, currently, rewrites imports for any of the |
Thanks for analyzing possible approaches. I would like to add the following constraints:
@nomego, you have already analyzed it quite beautifully. Would you work on a PR where I can contribute as needed? |
Yes of course it should work dynamically like today, where the dist version adapts dynamically to d3@5/d3@6. I made a PR for an example approach which needs some discussion and review in #1824, let me know what you think. |
In an effort to try and fix #1822 locally, I did an
npm install --save d3-collection
which installed v1.0.7.This stopped the server from erroring out but instead I get this in the console:
Uncaught SyntaxError: The requested module './../../../d3-selection/src/index.js' does not provide an export named 'event'
fromd3compat.js:1
.Looking at the installed version of d3-selection it's v2.0.0 where the
event
export seems to be gone.Downgrading with
npm install --save d3-selection@1.4.1
,event
is available but it fails withUncaught SyntaxError: The requested module './../../../d3-selection/src/index.js' does not provide an export named 'pointer'
on the same line, which seems to be an addition of v2.0.0.Not sure how this dep should be rectified.
The text was updated successfully, but these errors were encountered: