Skip to content

Commit ea21c8f

Browse files
committed
1. updated package.json
2. uptake of new way to insert scripts in HtmlPlugin 3. start using react-dom
1 parent 515837d commit ea21c8f

5 files changed

+9
-6
lines changed

package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,18 @@
2424
"eslint": "^1.6.0",
2525
"eslint-friendly-formatter": "^1.2.2",
2626
"eslint-loader": "^1.0.0",
27-
"file-loader": "*",
27+
"file-loader": "^0.8.1",
2828
"html-webpack-plugin": "^2.0.3",
2929
"image-webpack-loader": "^1.6.1",
3030
"jquery": "^3.0.0-alpha1",
3131
"node-sass": "^3.3.3",
3232
"postcss-loader": "^0.6.0",
3333
"react": "^0.14.0-rc1",
34+
"react-dom": "^0.14.0-rc1",
3435
"react-hot-loader": "^2.0.0-alpha-4",
3536
"sass-loader": "^3.0.0",
3637
"style-loader": "^0.12.4",
37-
"url-loader": "*",
38+
"url-loader": "^0.5.5",
3839
"webpack": "^1.12.2",
3940
"webpack-dev-server": "^1.12.0"
4041
},

src/scripts/app.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import ReactDOM from 'react-dom';
12
import React from 'react';
23
import WelcomeMsg from './components/welcomeMsg';
34

@@ -14,6 +15,6 @@ var features = [
1415
{name: 'Development and Production configuration and scripts', url: ''}
1516
];
1617

17-
React.render(
18+
ReactDOM.render(
1819
<WelcomeMsg features={features} />, document.getElementById('content')
1920
);

src/template_index.html

-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,5 @@
77
</head>
88
<body>
99
<div id="content"></div>
10-
<script src="{%=o.htmlWebpackPlugin.assets.main%}"></script>
1110
</body>
1211
</html>

webpack.config.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ var config = {
3737
},
3838
plugins: [
3939
new HtmlWebpackPlugin({
40-
template: './src/template_index.html'
40+
template: './src/template_index.html',
41+
inject: 'body' // Inject all scripts into the body
4142
})
4243
],
4344
postcss: [autoprefixer, csswring],

webpack.production.config.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ var config = {
3838
postcss: [autoprefixer, csswring],
3939
plugins: [
4040
new HtmlWebpackPlugin({
41-
template: './src/template_index.html'
41+
template: './src/template_index.html',
42+
inject: 'body' // Inject all scripts into the body
4243
}),
4344
// removes a lot of debugging code in React
4445
new webpack.DefinePlugin({

0 commit comments

Comments
 (0)