Skip to content

feat: rolldown vite full bundle mode #107

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

Draft
wants to merge 41 commits into
base: rolldown-vite
Choose a base branch
from

Conversation

underfin
Copy link
Member

@underfin underfin commented Apr 9, 2025

Make dev build could be work. You could pass npx vite --fullBundleMode at define/hmr-root to see the initial build success and visit the url at browser.

The HMR has issues, i will work for it at next.

@underfin underfin marked this pull request as draft April 9, 2025 09:52
@underfin underfin force-pushed the rolldown-vite-full-bundle-mode branch from f46540b to 744fe8b Compare April 15, 2025 08:12
@underfin underfin force-pushed the rolldown-vite-full-bundle-mode branch from c580d0c to 191a670 Compare April 21, 2025 08:33
Copy link

pkg-pr-new bot commented Apr 21, 2025

Open in StackBlitz

npm i https://pkg.pr.new/vitejs/rolldown-vite@107

commit: d9844ce

@underfin underfin changed the title wip: rolldown vite full bundle mode feat: rolldown vite full bundle mode Apr 21, 2025
'\t...typeof m === "object" && !Array.isArray(m) || typeof m === "function" ? m : {},\n' +
'\tdefault: m\n' +
'})(__vite__cjsImport0_react)',
'const react = ((m) => m?.__esModule ? m : { ...typeof m === "object" && !Array.isArray(m) || typeof m === "function" ? m : {}, default: m })(__vite__cjsImport0_react)',
Copy link
Member Author

Choose a reason for hiding this comment

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

It is wired for it coudle be success at rolldown-vite branch.

Copy link
Member

Choose a reason for hiding this comment

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

It's probably caused by the "vitest>vite" overrides. Vitest uses Vite to process the files and that changes the Function::toString result.

@underfin underfin marked this pull request as ready for review April 21, 2025 10:14
@underfin underfin marked this pull request as draft April 22, 2025 02:21
function importModuleWithFullBundleMode() {
const importPromise = import(base + url)
return importPromise.then(() =>
// @ts-expect-error globalThis.__rolldown_runtime__
Copy link
Member

Choose a reason for hiding this comment

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

In the future, I think it's good to have the types exposed from rolldown so that we can use it like:

declare var __rolldown_runtime__: RolldownHmrRuntime

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah.

'\t...typeof m === "object" && !Array.isArray(m) || typeof m === "function" ? m : {},\n' +
'\tdefault: m\n' +
'})(__vite__cjsImport0_react)',
'const react = ((m) => m?.__esModule ? m : { ...typeof m === "object" && !Array.isArray(m) || typeof m === "function" ? m : {}, default: m })(__vite__cjsImport0_react)',
Copy link
Member

Choose a reason for hiding this comment

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

It's probably caused by the "vitest>vite" overrides. Vitest uses Vite to process the files and that changes the Function::toString result.

Comment on lines +222 to +224
if (!server.httpServer) {
throw new Error('HTTP server not available')
}
Copy link
Member

Choose a reason for hiding this comment

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

We should probably support middleware mode (it does not have server.httpServer) in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants