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

Fix intermittent issue - Assets.getText() #180

Merged
merged 5 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 3 additions & 3 deletions packages/vite-bundler/loading/vite-connection-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ export class ViteDevScripts {
viteClientUrl: `${baseUrl}/@vite/client`,
}
}
public stringTemplate(): Promise<string> {

public async stringTemplate(): Promise<string> {
const { viteClientUrl, entrypointUrl } = this.urls;
const viteClient = `<script src="${viteClientUrl}" type="module" id="${VITE_CLIENT_SCRIPT_ID}"></script>`;
const viteEntrypoint = `<script src="${entrypointUrl}" type="module" id="${VITE_ENTRYPOINT_SCRIPT_ID}"></script>`;
Expand All @@ -27,7 +27,7 @@ export class ViteDevScripts {
return `${viteClient}\n${viteEntrypoint}`;
}

return Assets.getTextAsync('loading/dev-server-splash.html') as string;
return await Assets.getTextAsync('loading/dev-server-splash.html');
}

public injectScriptsInDOM() {
Expand Down
4 changes: 4 additions & 0 deletions packages/vite-bundler/types/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ declare global {
}
function getDefaultOptions(): CompileOptions;
}

module Assets {
function getTextAsync(path: string): Promise<string>;
}
}

export {}
Loading