Use HTML webpack plugin for one less thing to worry about.

This commit is contained in:
Timothy Farrell 2018-01-11 16:10:51 -06:00
parent f9cb05aba1
commit a947080e0e
3 changed files with 10 additions and 6 deletions

View File

@ -35,6 +35,7 @@
"styletron-utils": "^2.5.4"
},
"devDependencies": {
"html-webpack-plugin": "^2.30.1",
"webpack": "~3.8.1",
"webpack-dev-server": "~2.9.2"
}

View File

@ -1,10 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="/app.css">
<title>Photos</title>
</head>
<body>
<script src="/app.bundle.js"></script>
</body>
</html>

View File

@ -1,6 +1,7 @@
const path = require('path');
const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
context: path.resolve(__dirname, './src'),
@ -31,10 +32,12 @@ module.exports = {
]
},
plugins: [
new webpack.DefinePlugin({
__DEV__: true
}),
new ExtractTextPlugin('app.css', { allChunks: true })
new webpack.DefinePlugin({ __DEV__: true }),
new ExtractTextPlugin('app.css', { allChunks: true }),
new HtmlWebpackPlugin({
template: 'index.template.html',
inject: 'body'
})
],
devtool: 'source-map'
};