Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: reduce the chance of regenerating conventional routes #6220

Merged
merged 2 commits into from
Mar 7, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix: build
  • Loading branch information
sorrycc committed Mar 7, 2021
commit 52ebed8ab52bdcff201122fe5e2e1f0eec9591ba
14 changes: 10 additions & 4 deletions packages/core/src/Html/Html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ class Html {
path = path.replace(/^\//, '');
path = path.replace(/\/$/, '');

if (this.config.exportStatic?.htmlSuffix || path === 'index.html') {
if (
(this.config.exportStatic && this.config.exportStatic.htmlSuffix) ||
path === 'index.html'
) {
return `${path}`;
} else {
return `${path}/index.html`;
Expand All @@ -36,8 +39,11 @@ class Html {
const htmlPath = this.getHtmlPath(path);
const len = htmlPath.split('/').length;
return (
Array(this.config.exportStatic?.htmlSuffix ? len : len - 1).join('../') ||
'./'
Array(
this.config.exportStatic && this.config.exportStatic.htmlSuffix
? len
: len - 1,
).join('../') || './'
);
}

Expand All @@ -46,7 +52,7 @@ class Html {
return opts.file;
}
const file = opts.file.charAt(0) === '/' ? opts.file.slice(1) : opts.file;
if (this.config.exportStatic?.dynamicRoot) {
if (this.config.exportStatic && this.config.exportStatic.dynamicRoot) {
return `${this.getRelPathToPublicPath(opts.path || '/')}${file}`;
} else {
return `${this.config.publicPath}${file}`;
Expand Down