Skip to content

Commit 64f5c07

Browse files
committed
webpack2 setup.
1 parent 2634f5d commit 64f5c07

File tree

10 files changed

+45
-158
lines changed

10 files changed

+45
-158
lines changed

.babelrc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
{
2-
"stage": 0
2+
"presets": [
3+
"es2015",
4+
"stage-0",
5+
"react"
6+
]
37
}

doc/fail_in_safari.png

-89 KB
Binary file not shown.

doc/works_with_devtools_open.png

-152 KB
Binary file not shown.

package.json

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
{
22
"private": true,
3+
"scripts": {
4+
"start": "webpack-dev-server"
5+
},
36
"devDependencies": {
4-
"babel-core": "^5.8.29",
5-
"babel-loader": "^5.3.2",
6-
"browser-sync": "^2.9.11",
7-
"css-loader": "^0.21.0",
8-
"extract-text-webpack-plugin": "^0.8.2",
9-
"react-hot-loader": "^1.3.0",
7+
"babel-core": "^6.4.5",
8+
"babel-loader": "^6.2.1",
9+
"babel-preset-es2015": "^6.3.13",
10+
"babel-preset-react": "^6.3.13",
11+
"babel-preset-stage-0": "^6.3.13",
12+
"css-loader": "^0.23.1",
13+
"extract-text-webpack-plugin": "^1.0.1",
1014
"style-loader": "^0.13.0",
11-
"webpack": "^1.12.2",
12-
"webpack-dev-middleware": "^1.2.0",
13-
"webpack-dev-server": "^1.12.1",
14-
"webpack-hot-middleware": "^2.4.1",
15-
"write-file-webpack-plugin": "^1.0.0"
15+
"webpack": "^2.0.6-beta",
16+
"webpack-dev-server": "^2.0.0-beta"
1617
},
1718
"dependencies": {
18-
"react": "^0.14.0",
19-
"react-css-modules": "^3.6.1",
20-
"react-dom": "^0.14.0"
19+
"react": "^0.15.0-alpha.1",
20+
"react-css-modules": "^3.7.4",
21+
"react-dom": "^0.15.0-alpha.1"
2122
}
2223
}

src/UsingDecorator/index.js

Lines changed: 0 additions & 32 deletions
This file was deleted.

src/UsingStyleName/index.js

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,21 @@ import React from 'react';
22
import CSSModules from 'react-css-modules';
33
import styles from './../table.css';
44

5-
class Table extends React.Component {
5+
let Table;
66

7+
Table = class extends React.Component {
78
constructor(props) {
9+
super(props);
810

9-
super(props);
11+
this.state = {
12+
count: 0
13+
};
1014

11-
this.state = {
12-
count: 0
13-
};
14-
15-
// force updates in the component to break safari
16-
setInterval(() => {
17-
this.setState({
18-
count: this.state.count + 1
19-
});
20-
})
15+
setInterval(() => {
16+
this.setState({
17+
count: this.state.count + 1
18+
});
19+
}, 10);
2120
}
2221

2322
render () {

src/UsingStylesProperty/index.js

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,21 @@ import React from 'react';
22
import CSSModules from 'react-css-modules';
33
import styles from './../table.css';
44

5-
class Table extends React.Component {
5+
let Table;
66

7-
constructor(props) {
7+
Table = class extends React.Component {
8+
constructor (props) {
9+
super(props);
810

9-
super(props);
11+
this.state = {
12+
count: 0
13+
};
1014

11-
this.state = {
12-
count: 0
13-
};
14-
15-
// force updates in the component to break safari
16-
setInterval(() => {
17-
this.setState({
18-
count: this.state.count + 1
15+
setInterval(() => {
16+
this.setState({
17+
count: this.state.count + 1
18+
});
1919
});
20-
})
2120
}
2221

2322
render () {

src/index.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
import React from 'react';
22
import ReactDOM from 'react-dom';
3-
43
import UsingStyleName from './UsingStyleName';
5-
64
import UsingStylesProperty from './UsingStylesProperty';
75
import UsingStylesPropertyStyles from './UsingStylesProperty/custom.css';
86

9-
import UsingDecorator from './UsingDecorator';
10-
117
ReactDOM.render(<div>
128
<UsingStyleName />
139
<UsingStylesProperty styles={UsingStylesPropertyStyles} />
14-
<UsingDecorator />
1510
</div>, document.querySelector('#app'));

webpack.config.browsersync.js

Lines changed: 0 additions & 74 deletions
This file was deleted.

webpack.config.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,19 @@ devServer = {
1515
publicPath: '/static/',
1616
historyApiFallback: false,
1717
host: '127.0.0.1',
18+
lazy: true,
1819
port: 8000,
19-
hot: true
20+
hot: false
2021
};
2122

2223
module.exports = {
23-
devtool: 'source-map',
24+
devtool: 'source-source-map',
2425
debug: true,
2526
devServer: devServer,
2627
context: path.resolve(__dirname, './src'),
2728
entry: {
2829
app: [
2930
'webpack-dev-server/client?http://' + devServer.host + ':' + devServer.port,
30-
'webpack/hot/only-dev-server',
31-
3231
'./'
3332
]
3433
},
@@ -41,9 +40,6 @@ module.exports = {
4140
new ExtractTextPlugin('app.css', {
4241
allChunks: true
4342
}),
44-
new webpack.optimize.OccurenceOrderPlugin(),
45-
new webpack.HotModuleReplacementPlugin(),
46-
new webpack.OldWatchingPlugin(),
4743
new webpack.NoErrorsPlugin()
4844
],
4945
module: {
@@ -56,7 +52,6 @@ module.exports = {
5652
test: /\.js$/,
5753
include: path.resolve(__dirname, './src'),
5854
loaders: [
59-
'react-hot',
6055
'babel'
6156
]
6257
}

0 commit comments

Comments
 (0)