Skip to content

Commit 65f28c5

Browse files
committed
🐛 fix bug
1 parent cc1fa68 commit 65f28c5

File tree

4 files changed

+18
-80
lines changed

4 files changed

+18
-80
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ So you found those cool components that do what you want, but they work on fixed
88
import D3 from 'react-d3-components';
99
1010
<D3.BarChart
11-
width={500} /> // :(
11+
width={500} /> // ;_;
1212
~~~
1313

1414
You care about responsiveness and different display sizes! You want variable width! HULK SMASH!

dist/react-automatic-width.js

Lines changed: 1 addition & 68 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/react-automatic-width.jsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import React from 'react';
2+
13
class AutomaticWidth extends React.Component {
24
constructor() {
35
super();
@@ -17,15 +19,12 @@ class AutomaticWidth extends React.Component {
1719
}
1820
}
1921

20-
componentWillMount() {
22+
componentDidMount() {
2123
let boundListener = this._resizeHandler.bind(this);
2224
window.addEventListener('resize', boundListener);
2325
this.setState({
2426
listener: boundListener
2527
});
26-
}
27-
28-
componentDidMount() {
2928
this.state.listener();
3029
}
3130

webpack.config.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,30 @@ module.exports = {
1212
libraryTarget: 'umd'
1313
},
1414
plugins: [
15-
new webpack.BannerPlugin(require('./banner'))
16-
// new webpack.optimize.UglifyJsPlugin()
15+
new webpack.BannerPlugin(require('./banner')),
16+
new webpack.optimize.DedupePlugin(),
17+
new webpack.optimize.UglifyJsPlugin(),
18+
new webpack.DefinePlugin({
19+
"process.env": {
20+
NODE_ENV: JSON.stringify("production")
21+
}
22+
}),
1723
],
18-
externals: {
19-
'React': 'react'
20-
},
2124
resolve: {
22-
extensions: ['', '.jsx']
25+
extensions: ['', 'js', '.jsx']
2326
},
2427
eslint: {
2528
configFile: '.eslintrc'
2629
},
30+
externals: {
31+
'react': 'react'
32+
},
2733
module: {
2834
preLoaders: [
2935
{ test: /\.jsx$/, exclude: /node_modules/, loader: 'eslint' },
3036
],
3137
loaders: [
32-
{ test: /\.jsx$/, exclude: /node_modules/, loader: 'babel' },
38+
{ test: /\.jsx?$/, loader: 'babel' },
3339
]
3440
}
3541
};

0 commit comments

Comments
 (0)