Use HtmlWebpackPlugin for eployments
This commit is contained in:
parent
9506dcbca6
commit
67ca3c2ae2
File diff suppressed because one or more lines are too long
|
@ -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 +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":""}
|
|
@ -15,5 +15,5 @@
|
|||
// });
|
||||
// };
|
||||
</script>
|
||||
<script src="/static/bundle.js"></script></body>
|
||||
<script type="text/javascript" src="/static/bundle.0fbe6de0fb85ebae62bf.js"></script></body>
|
||||
</html>
|
|
@ -34,7 +34,7 @@
|
|||
"debug": "^2.2.0",
|
||||
"extract-text-webpack-plugin": "^1.0.1",
|
||||
"highlight.js": "^9.4.0",
|
||||
"html-webpack-plugin": "^2.16.1",
|
||||
"html-webpack-plugin": "^2.17.0",
|
||||
"http-errors": "^1.4.0",
|
||||
"isomorphic-fetch": "^2.2.1",
|
||||
"jsonwebtoken": "^5.7.0",
|
||||
|
|
|
@ -31,7 +31,7 @@ if (process.env.NODE_ENV === 'production') {
|
|||
}
|
||||
|
||||
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());
|
||||
});
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
var path = require('path');
|
||||
var webpack = require('webpack');
|
||||
var HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
|
||||
commonWebpackConfig = require('./webpack.config');
|
||||
|
||||
|
@ -11,11 +12,14 @@ productionWebpackConfig = Object.assign(commonWebpackConfig, {
|
|||
],
|
||||
output: {
|
||||
path: path.join(__dirname, 'dist'),
|
||||
filename: 'bundle.js',
|
||||
publicPath: '/static/'
|
||||
filename: 'bundle.[hash].js',
|
||||
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.UglifyJsPlugin({
|
||||
|
|
Reference in New Issue