Skip to content

Commit

Permalink
fix: remove duplicated slash for assetPrefix (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
fi3ework authored Aug 13, 2024
1 parent 272b397 commit aa6a356
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ export default async (
publicDir: false,
},
dev: {
assetPrefix: '/',
progressBar: !quiet,
},
source: {
Expand Down Expand Up @@ -291,12 +292,6 @@ export default async (
ignored: /node_modules/,
}

if (!isProd) {
// Using publicPath here to force drop slash in assetPrefix.
config.output = config.output || {}
config.output.publicPath = ''
}

config.ignoreWarnings = [
...(config.ignoreWarnings || []),
/export '\S+' was not found in 'global'/,
Expand Down
44 changes: 38 additions & 6 deletions packages/builder-rsbuild/templates/preview.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,39 @@

<meta name="viewport" content="width=device-width, initial-scale=1" />

<link rel="prefetch" href="./sb-common-assets/nunito-sans-regular.woff2" as="font" type="font/woff2" crossorigin />
<link rel="prefetch" href="./sb-common-assets/nunito-sans-italic.woff2" as="font" type="font/woff2" crossorigin />
<link rel="prefetch" href="./sb-common-assets/nunito-sans-bold.woff2" as="font" type="font/woff2" crossorigin />
<link rel="prefetch" href="./sb-common-assets/nunito-sans-bold-italic.woff2" as="font" type="font/woff2" crossorigin />
<link rel="stylesheet" href="./sb-common-assets/fonts.css" />
<style>
@font-face {
font-family: 'Nunito Sans';
font-style: normal;
font-weight: 400;
font-display: swap;
src: url('./sb-common-assets/nunito-sans-regular.woff2') format('woff2');
}
@font-face {
font-family: 'Nunito Sans';
font-style: italic;
font-weight: 400;
font-display: swap;
src: url('./sb-common-assets/nunito-sans-italic.woff2') format('woff2');
}
@font-face {
font-family: 'Nunito Sans';
font-style: normal;
font-weight: 700;
font-display: swap;
src: url('./sb-common-assets/nunito-sans-bold.woff2') format('woff2');
}
@font-face {
font-family: 'Nunito Sans';
font-style: italic;
font-weight: 700;
font-display: swap;
src: url('./sb-common-assets/nunito-sans-bold-italic.woff2') format('woff2');
}
</style>

<% if (typeof headHtmlSnippet !== 'undefined') { %> <%= headHtmlSnippet %> <% } %> <%
htmlWebpackPlugin.files.css.forEach(file => { %>
Expand Down Expand Up @@ -47,7 +75,11 @@
import './sb-preview/runtime.js';
<% htmlWebpackPlugin.files.js.forEach(file => { %>
import './<%= file %>';
<% if (file.startsWith('/')) { %>
import '.<%= file %>';
<% } else { %>
import './<%= file %>';
<% } %>
<% }); %>
</script>
</body>
Expand Down

0 comments on commit aa6a356

Please sign in to comment.