cannot import d3 libraries #1405
-
using v0.31.0, I cannot import the d3 libraries (I was looking for the cvs utilities they provide). The error is visible in the console:
You can see this in https://stackblitz.com/edit/github-szuap6fc though I had to download the project and run it with
as stackblitz did not seem to want to automatically start it after I installed d3. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
Thanks for reporting! I was able to reproduce as well so let me move to this to a discussion and just give me a little time to research what is going on and then I can file a specific issue once I better understand the root cause. |
Beta Was this translation helpful? Give feedback.
-
Ok, so was able to do some investigations and actually found two underlying oversights in the implementation. Sub-Only (Shallow) Export conditionsFirst was the immediate issue with d3 and the issue here is that it's sub-only exports conditions are being used as keys literally in the generated import map "exports": {
"umd": "./dist/d3.min.js",
"default": "./src/index.js"
}, So in that case, we shouldn't literally include the sub-only export condition in the import map key. Exports as an entry pointOnce I got that working, there was another issue that popped up from the robust-predicates package Looking at the generated imports map, clearly something was wrong 😅 So looking a little more closely, the issue here is quite simple, we're not handling the exports map when it is just and entry point. "exports": "./index.js", With both those items accounted for, I could get d3 to load Let me track these items and I will report back with links to those issues. The second case should be very low risk, and the first condition I will definitely want to do a little more testing across a few projects first but assuming all that looks good, likely I could plan to get this out as a v0.31.1 release. 🤞 |
Beta Was this translation helpful? Give feedback.
-
Thanks again for reporting. This should be all set now in the most recent release of Greenwood - v0.31.1 |
Beta Was this translation helpful? Give feedback.
OK, PR is up! - #1413
Should have this out for release in the next few days as v0.31.1.