mirror of
https://github.com/withastro/astro.git
synced 2025-04-07 23:41:43 -05:00
[ci] format
This commit is contained in:
parent
ea790542e1
commit
baf0c405dd
4 changed files with 10 additions and 7 deletions
|
@ -50,9 +50,9 @@ export type SSRManifest = {
|
|||
base: string;
|
||||
/**
|
||||
* The base of the assets generated **by the user**. For example, scripts created by the user falls under this category.
|
||||
*
|
||||
*
|
||||
* The value of this field comes from `vite.base`. We aren't usually this tight to vite in our code base, so probably
|
||||
* this should be refactored somehow.
|
||||
* this should be refactored somehow.
|
||||
*/
|
||||
userAssetsBase: string | undefined;
|
||||
trailingSlash: AstroConfig['trailingSlash'];
|
||||
|
|
|
@ -27,8 +27,9 @@ export function renderAllHeadContent(result: SSRResult) {
|
|||
const scripts = Array.from(result.scripts)
|
||||
.filter(uniqueElements)
|
||||
.map((script) => {
|
||||
if(result.userAssetsBase){
|
||||
script.props.src = (result.base === '/' ? '' : result.base) + result.userAssetsBase + script.props.src;
|
||||
if (result.userAssetsBase) {
|
||||
script.props.src =
|
||||
(result.base === '/' ? '' : result.base) + result.userAssetsBase + script.props.src;
|
||||
}
|
||||
return renderElement('script', script, false);
|
||||
});
|
||||
|
|
|
@ -20,5 +20,7 @@ export async function renderScript(result: SSRResult, id: string) {
|
|||
}
|
||||
|
||||
const resolved = await result.resolve(id);
|
||||
return markHTMLString(`<script type="module" src="${result.userAssetsBase ? ((result.base === '/' ? '' : result.base)+result.userAssetsBase) : ''}${resolved}"></script>`);
|
||||
return markHTMLString(
|
||||
`<script type="module" src="${result.userAssetsBase ? (result.base === '/' ? '' : result.base) + result.userAssetsBase : ''}${resolved}"></script>`,
|
||||
);
|
||||
}
|
||||
|
|
|
@ -54,8 +54,8 @@ describe('Astro dev with vite.base path', () => {
|
|||
headers,
|
||||
},
|
||||
vite: {
|
||||
base: '/hello'
|
||||
}
|
||||
base: '/hello',
|
||||
},
|
||||
});
|
||||
await fixture.build();
|
||||
devServer = await fixture.startDevServer();
|
||||
|
|
Loading…
Add table
Reference in a new issue