Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit d7ec214

Browse files
committed
fix(fusuma): fix publicPath for /
1 parent fed71a9 commit d7ec214

File tree

6 files changed

+24
-8
lines changed

6 files changed

+24
-8
lines changed

packages/fusuma/src/configs/fusumarc.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const config = {
3232
},
3333
build: {
3434
useCache: true,
35-
publicPath: '',
35+
publicPath: '/',
3636
},
3737
};
3838

packages/fusuma/src/server/dynamicRenderingServer.js

+8-5
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ async function dynamicRenderingServer(outputDirPath, publicPath, spinner, isThum
2222
});
2323
const page = await browser.newPage();
2424
const app = await fileServer(outputDirPath, publicPath, port);
25-
const url = `http://localhost:${port}?sidebar=false&pagination=false&ssr=true`;
25+
const url = `http://localhost:${port}/?sidebar=false&pagination=false&ssr=true`;
2626
const htmlPath = join(outputDirPath, 'index.html');
2727

2828
// https://www.kapwing.com/resources/what-is-an-og-image-make-and-format-og-images-for-your-blog-or-webpage/
@@ -32,12 +32,15 @@ async function dynamicRenderingServer(outputDirPath, publicPath, spinner, isThum
3232
});
3333

3434
page.on('request', (request) => {
35-
const url = request.url();
35+
const requestedUrl = request.url();
3636

37-
if (url.includes(`http://localhost:${port}${publicPath}`)) {
38-
logs.network.push(url.split(`http://localhost:${port}${publicPath}`).pop());
37+
if (requestedUrl === url) {
38+
return;
39+
}
40+
if (requestedUrl.includes(`http://localhost:${port}${publicPath}`)) {
41+
logs.network.push(requestedUrl.split(`http://localhost:${port}${publicPath}`).pop());
3942
} else {
40-
logs.network.push(url);
43+
logs.network.push(requestedUrl);
4144
}
4245
});
4346

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"name": "publicpath",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1",
8+
"build": "fusuma build"
9+
},
10+
"author": "hiroppy <git@hiroppy.me> (https://hiroppy.me/)",
11+
"license": "MIT"
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# hello

scripts/build-samples.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const dirs = getDirs(base);
1313
for (let i = 0; i < dirs.length; i++) {
1414
const name = dirs[i];
1515

16-
if (!['syntaxes'].includes(name)) {
16+
if (!['syntaxes', 'issues'].includes(name)) {
1717
console.log('=================', name, '=================');
1818

1919
execSync(`cd ${join(base, name)} && npm run build`, { stdio: 'inherit' });

scripts/deploy-samples.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const getDirs = (p) => readdirSync(p).filter((f) => statSync(join(p, f)).isDirec
1313
for (let i = 0; i < dirs.length; i++) {
1414
const name = dirs[i];
1515

16-
if (!['syntaxes'].includes(name)) {
16+
if (!['syntaxes', 'issues'].includes(name)) {
1717
await deploy(
1818
{
1919
internal: {

0 commit comments

Comments
 (0)