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

docs: add a note about transport between the server and the runner #17660

Merged

Conversation

sheremet-va
Copy link
Member

@sheremet-va sheremet-va commented Jul 11, 2024

Description

Added our current thoughts about the transport API. @hi-ogawa do you have any thoughts? I am open to discussion.

Copy link

stackblitz bot commented Jul 11, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

return source === 'virtual:index-html' ? '\0' + source : undefined
},
async load(id, _options) {
if (id === '\0' + 'virtual:index-html') {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we expose this as something like runner.html(url, htmlPath)? Feels weird that every framework now has to implement this

cc @patak-dev @hi-ogawa

Copy link
Member Author

@sheremet-va sheremet-va Jul 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To support runner.html(), we would have to ask for fetchHtml method alongside fetchModule (right now transport only requires fetchModule) - or I guess we can also have an option like html: true 🤔

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use index.html for my quick setup (and also create-vite-extra template too e.g. https://github.com/bluwy/create-vite-extra/blob/master/template-ssr-react/server.js), but in practice, I'm not sure if actual framework would benefit from this since they usually have more opinionated way to generate the html shell.

At least for the frameworks I'm aware of, they don't have index.html convention. Instead, they have only "client entry" script and they can use it as rollupOpitons.input. They also have an access to client build manifest, so they can find "production client entry" asset path from manifest and renders <script> (also <link> for css, preload, etc...) on their own into their html shell.

So, I think having runner.html() would help only "entry level" ssr framework exploration and I'm not sure if it's worth it to have in core. For that case, showing this virtual:index-html idea here is probably helpful enough.

@sheremet-va
Copy link
Member Author

@hi-ogawa added last note, pls check

@sheremet-va sheremet-va merged commit 5e9fec4 into vitejs:v6/environment-api Sep 4, 2024
4 checks passed
@sheremet-va sheremet-va deleted the docs/env-transport-virtual branch September 4, 2024 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants