Skip to content

Commit

Permalink
Merge branch 'hotfix/1.0.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
SolarLiner committed Oct 20, 2018
2 parents 54e8187 + 0351a28 commit 2ed49cc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
15 changes: 14 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,19 @@ module.exports = (api, projectOptions) => {
if (options.customRendererConfig) {
Object.assign(rendererConfig, options.customRendererConfig);
}

const renderer = new Renderer(rendererConfig);
if (projectOptions.baseUrl) {
renderer.preServer = (Prerenderer) => {
const prefix = projectOptions.baseUrl;
Prerenderer._server._expressServer.use((req, res, next) => {
if (req.url.indexOf(prefix) === 0) {
req.url = req.url.slice(prefix.length - 1);
}
next();
});
};
}

config.plugin("pre-render").use(PrerenderSPAPlugin, [
{
Expand All @@ -34,7 +47,7 @@ module.exports = (api, projectOptions) => {
path.join(projectOptions.outputDir, projectOptions.indexPath)
),
routes: options.renderRoutes,
renderer: new Renderer(rendererConfig)
renderer
}
]);
});
Expand Down
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "vue-cli-plugin-prerender-spa",
"version": "1.0.1",
"version": "1.0.3",
"description": "Vue CLI plugin to add prerendering to your application",
"main": "index.js",
"author": {
"name": "Nathan Graule",
"email": "[email protected]",
"email": "[email protected]"
},
"license": "MIT",
"repository": "https://github.com/SolarLiner/vue-cli-plugin-prerender-spa",
Expand All @@ -15,8 +15,7 @@
"plugin",
"prerender",
"SPA"

]
],
"private": false,
"dependencies": {
"javascript-stringify": "^1.6.0",
Expand Down

0 comments on commit 2ed49cc

Please sign in to comment.