This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<head> ... </head> | |
<body> | |
<div id="app"> | |
<div class="container"> | |
<h1>Your Server-Side Rendered App</h1> | |
<div class="component-1"> | |
<p>Hello World</p> | |
<!--etc etc. This was all rendered on the server--> | |
</app> | |
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ vue init webpack-simple vue-node-pr-test | |
$ cd vue-node-pr-test | |
$ npm install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ npm install --save-dev http-server html-webpack-plugin prerender-spa-plugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var HtmlWebpackPlugin = require('html-webpack-plugin'); | |
module.exports.plugins.push( | |
new HtmlWebpackPlugin({ | |
template: './index.html', | |
inject: false | |
}), | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
output: { | |
path: path.resolve(__dirname, './dist'), | |
filename: 'build.js', | |
publicPath: '/', // was originally 'dist' | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ npm run build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- dist | |
-- build.js | |
-- index.html | |
-- logo.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>vue-node-pr-test</title> | |
</head> | |
<body> | |
<div id="app"></div> | |
<script type="text/javascript" src="/build.js"></script> | |
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ./node_modules/.bin/http-server ./dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var PrerenderSpaPlugin = require('prerender-spa-plugin'); | |
module.exports.plugins.push( | |
new PrerenderSpaPlugin( | |
path.join(__dirname, './dist'), | |
[ '/' ] | |
) | |
); |