Skip to content

Commit 2ed49cc

Browse files
committed
Merge branch 'hotfix/1.0.3'
2 parents 54e8187 + 0351a28 commit 2ed49cc

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

index.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,19 @@ module.exports = (api, projectOptions) => {
2222
if (options.customRendererConfig) {
2323
Object.assign(rendererConfig, options.customRendererConfig);
2424
}
25+
26+
const renderer = new Renderer(rendererConfig);
27+
if (projectOptions.baseUrl) {
28+
renderer.preServer = (Prerenderer) => {
29+
const prefix = projectOptions.baseUrl;
30+
Prerenderer._server._expressServer.use((req, res, next) => {
31+
if (req.url.indexOf(prefix) === 0) {
32+
req.url = req.url.slice(prefix.length - 1);
33+
}
34+
next();
35+
});
36+
};
37+
}
2538

2639
config.plugin("pre-render").use(PrerenderSPAPlugin, [
2740
{
@@ -34,7 +47,7 @@ module.exports = (api, projectOptions) => {
3447
path.join(projectOptions.outputDir, projectOptions.indexPath)
3548
),
3649
routes: options.renderRoutes,
37-
renderer: new Renderer(rendererConfig)
50+
renderer
3851
}
3952
]);
4053
});

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"name": "vue-cli-plugin-prerender-spa",
3-
"version": "1.0.1",
3+
"version": "1.0.3",
44
"description": "Vue CLI plugin to add prerendering to your application",
55
"main": "index.js",
66
"author": {
77
"name": "Nathan Graule",
8-
"email": "[email protected]",
8+
"email": "[email protected]"
99
},
1010
"license": "MIT",
1111
"repository": "https://github.com/SolarLiner/vue-cli-plugin-prerender-spa",
@@ -15,8 +15,7 @@
1515
"plugin",
1616
"prerender",
1717
"SPA"
18-
19-
]
18+
],
2019
"private": false,
2120
"dependencies": {
2221
"javascript-stringify": "^1.6.0",

0 commit comments

Comments
 (0)