Skip to content

Commit

Permalink
fix(all): Re-organize import from d3
Browse files Browse the repository at this point in the history
- Updated module importing to be from specific module
- Removed exporting d3
- Added webpack-monitor

Fix #285
Close #313
  • Loading branch information
netil authored Feb 28, 2018
1 parent b04ba3d commit c11a215
Show file tree
Hide file tree
Showing 41 changed files with 9,814 additions and 17,192 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ addons:
cache:
yarn: true
directories:
- "node_modules"
- $HOME/.npm
before_script:
- greenkeeper-lockfile-update
- npm run lint
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,11 @@ Load billboard.js after D3.js.
or use importing ESM.

```js
// as named import
import {bb} from "billboard.js";

// or as importing default
import bb from "billboard.js";
```

> **Note**
Expand Down
4 changes: 3 additions & 1 deletion config/uglify.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ module.exports = {
comments: false
},
keep_fnames: true,
warnings: false
warnings: false,
dead_code: true,
unused: true
},
sourceMap: true
};
17 changes: 9 additions & 8 deletions config/webpack.config.packaged.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ const config = {
},
devtool: false,
module: {
rules: [{
test: /\.scss$/,
use: [{
loader: "css-loader"
}, {
loader: "sass-loader"
}]
}],
rules: [
{
test: /\.scss$/,
use: [
{loader: "css-loader"},
{loader: "sass-loader"}
],
}
],
},
plugins: [
new UglifyJSPlugin(uglifyConfig),
Expand Down
12 changes: 9 additions & 3 deletions config/webpack.config.production.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,20 @@ const uglifyConfig = require("./uglify");
const banner = require("./banner");
const OptimizeCssAssetsPlugin = require("optimize-css-assets-webpack-plugin");
const ExtractTextPlugin = require("extract-text-webpack-plugin");

const config = {
entry: {
"billboard": "./src/core.js",
"billboard.min": "./src/core.js",
},
externals: [{
"d3": "d3"
}],
externals: function(context, request, callback) {
// every 'd3-*' import, will be externally required as 'd3'
if(/^d3-/.test(request)) {
return callback(null, "d3");
}

callback();
},
module: {
rules: [
{
Expand Down
4 changes: 2 additions & 2 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ module.exports = function(config) {
[
"env",
{
"loose": true,
"modules": false
loose: true,
modules: false
}
]
],
Expand Down
Loading

0 comments on commit c11a215

Please sign in to comment.