-
Notifications
You must be signed in to change notification settings - Fork 7
test: test rolldown-vite #673
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
Closed
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
github-merge-queue bot
pushed a commit
to rolldown/rolldown
that referenced
this pull request
Jan 29, 2025
### Description I added a fake "deprecated" type to reduce a churn due to ecosystem failing by ts error (see https://github.com/vitejs/vite-ecosystem-ci/blob/rolldown-vite/README-temp.md and also my plugin hit by this too hi-ogawa/vite-plugins#673). As I wrote in #3337 (comment), Rolldown's plugin hook always works same as rollup's `sequential: true` and this behavior is likely good for the ecosystem since people mostly needed `sequential: true` to avoid running `writeBundle` hooks in parallel on rollup. I think the test added in #1913 already verifies such sequential behavior.
1842054 to
f57e5c7
Compare
hi-ogawa
added a commit
that referenced
this pull request
Feb 4, 2025
Merged
hi-ogawa
added a commit
that referenced
this pull request
Feb 4, 2025
github-merge-queue bot
pushed a commit
to rolldown/rolldown
that referenced
this pull request
Feb 5, 2025
### Description Reviving #1928. I came across `import.meta.url.ROLLUP_FILE_URL_xxx` in one of my plugins (hi-ogawa/vite-plugins#673) and I think having the compat in rolldown is nice to have (though it's also possible to have a compat in rolldown-vite or user land level via a custom plugin's `renderChunk` replacing). Sapphi also mentioned that Astro uses this feature #819 (comment). I'm hoping the complexity required on rolldown side is low and it's worth the inclusion. Let me know what you think. <details><summary>Example user-land plugin to replace "import.meta.ROLLUP_FILE_URL_xxx"</summary> From hi-ogawa/vite-plugins#673 ```js import path from "node:path"; import MagicString from "magic-string"; import type { Plugin } from "vite"; // import.meta.ROLLUP_FILE_URL_xxx on rolldown // #1928 export function rolldownPluginRollupFileUrl(): Plugin { return { name: rolldownPluginRollupFileUrl.name, renderChunk: { order: "pre", handler(code, chunk) { if (!code.includes("import.meta.ROLLUP_FILE_URL_")) { return; } const matches = code.matchAll(/import.meta.ROLLUP_FILE_URL_(\w+)/dg); const output = new MagicString(code); for (const match of matches) { const referenceId = match[1]!; const assetFileName = this.getFileName(referenceId); const relativePath = "./" + path.relative( path.resolve(chunk.fileName, ".."), path.resolve(assetFileName), ); const replacement = `new URL(${JSON.stringify(relativePath)}, import.meta.url)`; const [start, end] = match.indices![0]!; output.update(start, end, replacement); } if (output.hasChanged()) { return { code: output.toString(), map: output.generateMap({ hires: "boundary" }), }; } return; }, }, }; } ``` </details>
f282526 to
0e07a8c
Compare
7 tasks
Owner
Author
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
issues
next/ogfailsROLLUP_FILE_URL_xxxrenderChunkreplacement.import.meta.ROLLUP_FILE_URL_(referenceId)rolldown/rolldown#3488prerenderPluginfailsvirtual:react-server-build'sresolveId: { id: "../rsc/index.js", external: true }needs to be adjusted?packages/react-server/examples/basicpackages/react-server/examples/basicandtest-vite-glob-routeschunk.modulesunocss/unocss#4403pnpm -C packages/react-server/examples/basic cf-builderrors withcreateRequireimportnoExternal: trueon ssr build and that's probably a reasonable thing to do anyway since rolldown is fast.todo