Use HtmlWebpackPlugin for eployments

This commit is contained in:
Jori Lallo
2016-05-23 20:35:19 -07:00
parent 9506dcbca6
commit 67ca3c2ae2
7 changed files with 21 additions and 17 deletions

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
{"version":3,"file":"bundle.0fbe6de0fb85ebae62bf.js","sources":["webpack:///bundle.0fbe6de0fb85ebae62bf.js","webpack:///"],"mappings":"AAAA;ACwwHA;AAy/EA;AAyiFA;AA28FA;AAr1IA;AA45IA;;;;;AAo9GA;;;;;AAglFA;AAg7GA;;;;;;;;;;;;;;AAgxCA;AA+rHA;AA8pEA;AAklEA;AAmqEA;AA0gEA;AAowFA;AAunIA;AA2sEA;AAwiEA;AAygDA;AA6hJA;AA4kEA;AA8iIA;AA+mHA;AAu5FA;AA8zEA","sourceRoot":""}

1
dist/bundle.js.map vendored
View File

@ -1 +0,0 @@
{"version":3,"file":"bundle.js","sources":["webpack:///bundle.js","webpack:///"],"mappings":"AAAA;ACwwHA;AAy/EA;AAyiFA;AA28FA;AAr1IA;AA45IA;;;;;AAo9GA;;;;;AAglFA;AAg7GA;;;;;;;;;;;;;;AAgxCA;AA+rHA;AA8pEA;AAklEA;AAmqEA;AA0gEA;AAowFA;AAunIA;AA0sEA;AAyiEA;AAugDA;AA8hJA;AAsyEA;AAo1HA;AA6lHA;AAq6FA;AA8yEA","sourceRoot":""}

2
dist/index.html vendored
View File

@ -15,5 +15,5 @@
// }); // });
// }; // };
</script> </script>
<script src="/static/bundle.js"></script></body> <script type="text/javascript" src="/static/bundle.0fbe6de0fb85ebae62bf.js"></script></body>
</html> </html>

View File

@ -34,7 +34,7 @@
"debug": "^2.2.0", "debug": "^2.2.0",
"extract-text-webpack-plugin": "^1.0.1", "extract-text-webpack-plugin": "^1.0.1",
"highlight.js": "^9.4.0", "highlight.js": "^9.4.0",
"html-webpack-plugin": "^2.16.1", "html-webpack-plugin": "^2.17.0",
"http-errors": "^1.4.0", "http-errors": "^1.4.0",
"isomorphic-fetch": "^2.2.1", "isomorphic-fetch": "^2.2.1",
"jsonwebtoken": "^5.7.0", "jsonwebtoken": "^5.7.0",

View File

@ -31,7 +31,7 @@ if (process.env.NODE_ENV === 'production') {
} }
router.get('*', async (ctx) => { router.get('*', async (ctx) => {
const stats = await sendfile(ctx, path.join(__dirname, './static/dev.html')); const stats = await sendfile(ctx, path.join(__dirname, '../dist/index.html'));
if (!ctx.status) ctx.throw(httpErrors.NotFound()); if (!ctx.status) ctx.throw(httpErrors.NotFound());
}); });

View File

@ -1,5 +1,6 @@
var path = require('path'); var path = require('path');
var webpack = require('webpack'); var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
commonWebpackConfig = require('./webpack.config'); commonWebpackConfig = require('./webpack.config');
@ -11,11 +12,14 @@ productionWebpackConfig = Object.assign(commonWebpackConfig, {
], ],
output: { output: {
path: path.join(__dirname, 'dist'), path: path.join(__dirname, 'dist'),
filename: 'bundle.js', filename: 'bundle.[hash].js',
publicPath: '/static/' publicPath: '/static/',
}, },
}); });
productionWebpackConfig.plugins.push(new HtmlWebpackPlugin({
template: 'server/static/index.html'
}));
productionWebpackConfig.plugins.push(new webpack.optimize.OccurenceOrderPlugin()); productionWebpackConfig.plugins.push(new webpack.optimize.OccurenceOrderPlugin());
productionWebpackConfig.plugins.push( productionWebpackConfig.plugins.push(
new webpack.optimize.UglifyJsPlugin({ new webpack.optimize.UglifyJsPlugin({