Skip to content

Commit

Permalink
Switch from prerender-spa-plugin to react-snap
Browse files Browse the repository at this point in the history
  • Loading branch information
stereobooster committed Jan 10, 2018
1 parent 7fffc3b commit ee73d39
Show file tree
Hide file tree
Showing 4 changed files with 191 additions and 507 deletions.
6 changes: 5 additions & 1 deletion examples/vue2-webpack-router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"scripts": {
"dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot",
"build": "rm -rf ./dist && cross-env NODE_ENV=production webpack --progress --hide-modules",
"postbuild": "react-snap",
"deploy": "firebase deploy"
},
"dependencies": {
Expand All @@ -18,11 +19,14 @@
"css-loader": "^0.25.0",
"file-loader": "^0.9.0",
"html-webpack-plugin": "^2.30.1",
"prerender-spa-plugin": "^2.1.0",
"react-snap": "^1.6.1",
"vue-loader": "^12.1.0",
"vue-router": "^2.7.0",
"vue-template-compiler": "^2.3.3",
"webpack": "^2.6.1",
"webpack-dev-server": "^2.4.5"
},
"reactSnap": {
"source": "dist"
}
}
4 changes: 4 additions & 0 deletions examples/vue2-webpack-router/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ new Vue({
router,
render: h => h(App)
})

window.snapSaveState = () => {
document.querySelector('#app').setAttribute('data-server-rendered', 'true')
};
10 changes: 0 additions & 10 deletions examples/vue2-webpack-router/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
var path = require('path')
var webpack = require('webpack')
var PrerenderSpaPlugin = require('prerender-spa-plugin')
var HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
Expand Down Expand Up @@ -55,15 +54,6 @@ if (process.env.NODE_ENV === 'production') {
filename: path.resolve(__dirname, 'dist/index.html'),
favicon: 'favicon.ico'
}),
new PrerenderSpaPlugin(
// Absolute path to compiled SPA
path.resolve(__dirname, './dist'),
// List of routes to prerender
[ '/', '/about', '/contact' ],
{
// options
}
)
])
} else {
// NODE_ENV === 'development'
Expand Down
Loading

0 comments on commit ee73d39

Please sign in to comment.