naver / billboard.js

📊 Re-usable, easy interface JavaScript chart library based on D3.js
https://naver.github.io/billboard.js/
MIT License
5.77k stars 345 forks source link

When using AMD, I would like to specify d3 dependency as an integrated module rather than an individual module. #1195

Open hiuny opened 4 years ago

hiuny commented 4 years ago

Description

AMD방식으로 사용하려고 보니 d3의 개별 모듈을 정의해야 해서 좀 번거로운 것 같습니다. 1.6.0 이전에는 하나로 합쳐진 의존이어서 편했는데 혹시 AMD에 한해 다시 이전처럼 하나로 합쳐진 의존으로 돌아가는 건 어려울까요?

in english It seems a bit cumbersome to use the AMD method because I have to define individual modules of d3. Prior to 1.6.0, this was specified as a single dependency, which was convenient. Is it difficult for AMD to go back?

as-is

(function() {
  require.config({
    "paths": {
      "d3-time-format": "https://d3js.org/d3-time-format.v2.min",
      "d3-selection": "https://d3js.org/d3-selection.v1.min",
      "d3-transition": "https://d3js.org/d3-transition.v1.min",
      "d3-axis": "https://d3js.org/d3-axis.v1.min",
      "d3-brush": "https://d3js.org/d3-brush.v1.min",
      "d3-scale": "https://d3js.org/d3-scale.v3.min",
      "d3-dsv": "https://d3js.org/d3-dsv.v1.min",
      "d3-drag": "https://d3js.org/d3-drag.v1.min",
      "d3-shape": "https://d3js.org/d3-shape.v1.min",
      "d3-interpolate": "https://d3js.org/d3-interpolate.v1.min",
      "d3-color": "https://d3js.org/d3-color.v1.min",
      "d3-zoom": "https://d3js.org/d3-zoom.v1.min",
      "d3-ease": "https://d3js.org/d3-ease.v1.min",
      "d3-time": "https://d3js.org/d3-time.v1.min",
      "d3-dispatch": "https://d3js.org/d3-dispatch.v1.min",
      "d3-timer": "https://d3js.org/d3-timer.v1.min",
      "d3-array": "https://d3js.org/d3-array.v2.min",
      "d3-format": "https://d3js.org/d3-format.v1.min",
      "d3-path": "https://d3js.org/d3-path.v1.min",
      "billboardjs": "https://cdn.jsdelivr.net/npm/billboard.js@1.11.1/dist/billboard.min",
      "app": "./app"
    }
  });
  require(["app"], function(App) {
    new App();
  });
})();

to-be

(function() {
  require.config({
    "paths": {
      "d3": "https://cdnjs.cloudflare.com/ajax/libs/d3/5.15.0/d3.min",
      "billboardjs": "https://cdn.jsdelivr.net/npm/billboard.js@1.11.1/dist/billboard.min",
      "app": "./app"
    }
  });
  require(["app"], function(App) {
    new App();
  });
})();
stof commented 4 years ago

d3 is way bigger than the components needed by billboard. So from a performance point of view, that looks weird.