fix(server-bundle): keep the with key on externalized icon JSON imports - #523
Merged
Conversation
commit: |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe module adds a Rollup Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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
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.
🔗 Linked issue
Resolves #522
📚 Description
externalizeIconsJsongeneratesimport('@iconify-json/…/icons.json', { with: { type: 'json' } })(
src/bundle-server.ts:57), but Rollup 4 re-prints the attributes of external modules with its owndefault key,
assert— and Node.js removedassertin v22, so the icon API 500s withERR_IMPORT_ATTRIBUTE_MISSINGwhile the build stays green. Same user-visible error as #186, which#187 fixed by adding the attribute; this time it's written correctly and lost downstream.
Rollup only flips that default in v5 (rollup/rollup#6248, merged to
rollup-5, unreleased). Nitrohas the same gap and I've filed nitrojs/nitro#4518 for it, but a fix there won't reach anyone on a
released Nitro — and this module is the one that creates the external import. So it sets the key
itself, from the plugin it already installs, via
outputOptions:||=leaves an explicit usersetting alone, it works whether the build has one output or several, and nothing outside this
plugin is touched.
After this, the README's promise — "in the final build, it will contain statements like
() => import('@iconify-json/ph/icons.json', { with: { type: 'json' } })" — holds again.Verification
In
playgrounds/nuxt, withserverBundle: { externalizeIconsJson: true }andpnpm play:build:The underlying Rollup/Nitro behaviour, on plain Nitro without Nuxt (so the 500 and the 200 are easy
to see): https://github.com/agantelin/nitro-import-attributes-repro
No unit test: the hook this touches is the
nitro:configone, which the current suite doesn'texercise, and the playground build above is the honest check. Glad to add one if you'd like it
covered.