-
-
Notifications
You must be signed in to change notification settings - Fork 274
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
fail to import d3 #2392
Comments
sorry, change |
You can do simply import d3 from 'd3/build/d3.min.js'; without changing However @guybedford I believe that there should be a way to tell if
In D3 "main": "build/d3.node.js",
"unpkg": "build/d3.min.js",
"jsdelivr": "build/d3.min.js",
"module": "index",
"jsnext:main": "index", Even if we override If |
@amenadiel I've often thought about this scenario. I ran into the issue over a year ago with ESRI Leaflet. It could be really valuable to have a setting for this, but how should it work?
|
Well, in webpack you can set which fields use as main as an array: ['module', 'jsnext:main', 'main'] and tries those fields in that same order. However, if a global config was added to jspm, it would complicate resolution flow. For example, if a package.json had a module field, but had also a jspm entry declaring it's an AMD module, which one should prevail? There are other edge cases, for example if a library is a dependency for two others, one of them importing the module and the other one requiring the UMD build. There would be a race condition to fill up the SystemJS registry with the result. Of course, this issue only manifests itself in cases like d3, where it's meant to be an ES6 package but declares a |
JSPM Version: 0.16.53
Transpiler Plugin(s): babel
Details:
installed d3 with
jspm install d3
importing with
import d3 from 'd3';
(all according to 'get started' template)having error in console:
Uncaught (in promise) Error: (SystemJS) Node child_process module not supported in browsers.
Evaluating http://localhost:63342/jspm-packages/github/jspm/nodelibs-child_process@0.1.0/index.js
problem is in jspm-packages/npm/d3@4.12.2.js :
module.exports = require("npm:d3@4.12.2/build/d3.node.js");
after changing it to
module.exports = require("npm:d3@4.12.2/build/d3.min.js"); it started to work
this is contained in jspm_packages/d3@4.12.2/build/packaje.json:
export var main = "build/d3.node.js"; <--- !!!!!
export var unpkg = "build/d3.min.js";
export var jsdelivr = "build/d3.min.js"; <--- !!!!!
there is some kind of related issue thread in d3 d3/d3-request#24
The text was updated successfully, but these errors were encountered: