Skip to content

Commit

Permalink
fix: use endsWith for publicPath
Browse files Browse the repository at this point in the history
  • Loading branch information
hiroppy committed Jan 25, 2021
1 parent 1a839b6 commit b443dfa
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/fusuma/src/configs/fusumarc.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const config = {
},
build: {
useCache: true,
publicPath: '/',
publicPath: '',
},
};

Expand Down
4 changes: 1 addition & 3 deletions packages/fusuma/src/tasks/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ const outputBuildInfo = require('../webpack/outputBuildInfo');
const dynamicRenderingServer = require('../server/dynamicRenderingServer');

async function build(config, isConsoleOutput = true) {
if (process.env.NODE_ENV === undefined) {
process.env.NODE_ENV = 'production';
}
process.env.NODE_ENV = 'production';

const spinner = new Spinner();
const { outputDirPath } = config.internal;
Expand Down
2 changes: 1 addition & 1 deletion packages/fusuma/src/tasks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async function tasks({ type, options }) {
try {
const { pathname } = new URL(config.meta.url);

config.build.publicPath = `${pathname}/`;
config.build.publicPath = pathname.endsWith('/') ? pathname : `${pathname}/`;
} catch (e) {
error('preparation', `meta.url specified isn't a URL`);
}
Expand Down
4 changes: 1 addition & 3 deletions packages/fusuma/src/tasks/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ const { start: webpackStart } = require('../webpack');
const { warn } = require('../cli/log');

async function start(config) {
if (process.env.NODE_ENV === undefined) {
process.env.NODE_ENV = 'development';
}
process.env.NODE_ENV = 'development';

const spinner = new Spinner();

Expand Down
2 changes: 1 addition & 1 deletion packages/fusuma/src/webpack/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ module.exports = (
filename: 'index.html',
title: title || 'slide',
template: path.join(__dirname, 'template.ejs'),
image: thumbnail || `${url}/thumbnail.png`,
image: thumbnail || `${url.endsWith('/') ? url : `${url}/`}thumbnail.png`,
siteName,
description,
math,
Expand Down
2 changes: 1 addition & 1 deletion samples/intro/.fusumarc.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
meta:
url: https://hiroppy.github.io/fusuma/intro
url: https://hiroppy.github.io/fusuma/intro/
title: What's Fusuma?
description: Introduce Fusuma
siteName: hiroppy.me
Expand Down

0 comments on commit b443dfa

Please sign in to comment.