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

Commit b443dfa

Browse files
committed
fix: use endsWith for publicPath
1 parent 1a839b6 commit b443dfa

File tree

6 files changed

+6
-10
lines changed

6 files changed

+6
-10
lines changed

packages/fusuma/src/configs/fusumarc.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const config = {
4141
},
4242
build: {
4343
useCache: true,
44-
publicPath: '/',
44+
publicPath: '',
4545
},
4646
};
4747

packages/fusuma/src/tasks/build.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ const outputBuildInfo = require('../webpack/outputBuildInfo');
99
const dynamicRenderingServer = require('../server/dynamicRenderingServer');
1010

1111
async function build(config, isConsoleOutput = true) {
12-
if (process.env.NODE_ENV === undefined) {
13-
process.env.NODE_ENV = 'production';
14-
}
12+
process.env.NODE_ENV = 'production';
1513

1614
const spinner = new Spinner();
1715
const { outputDirPath } = config.internal;

packages/fusuma/src/tasks/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ async function tasks({ type, options }) {
2828
try {
2929
const { pathname } = new URL(config.meta.url);
3030

31-
config.build.publicPath = `${pathname}/`;
31+
config.build.publicPath = pathname.endsWith('/') ? pathname : `${pathname}/`;
3232
} catch (e) {
3333
error('preparation', `meta.url specified isn't a URL`);
3434
}

packages/fusuma/src/tasks/start.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ const { start: webpackStart } = require('../webpack');
66
const { warn } = require('../cli/log');
77

88
async function start(config) {
9-
if (process.env.NODE_ENV === undefined) {
10-
process.env.NODE_ENV = 'development';
11-
}
9+
process.env.NODE_ENV = 'development';
1210

1311
const spinner = new Spinner();
1412

packages/fusuma/src/webpack/webpack.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ module.exports = (
147147
filename: 'index.html',
148148
title: title || 'slide',
149149
template: path.join(__dirname, 'template.ejs'),
150-
image: thumbnail || `${url}/thumbnail.png`,
150+
image: thumbnail || `${url.endsWith('/') ? url : `${url}/`}thumbnail.png`,
151151
siteName,
152152
description,
153153
math,

samples/intro/.fusumarc.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
meta:
2-
url: https://hiroppy.github.io/fusuma/intro
2+
url: https://hiroppy.github.io/fusuma/intro/
33
title: What's Fusuma?
44
description: Introduce Fusuma
55
siteName: hiroppy.me

0 commit comments

Comments
 (0)