Skip to content

feat(vite): support ?assets import#3662

Merged
pi0 merged 9 commits intonitrojs:mainfrom
hi-ogawa:10-05-feat_vite_add_experimental.ssrassets_for_assets_query_import
Oct 24, 2025
Merged

feat(vite): support ?assets import#3662
pi0 merged 9 commits intonitrojs:mainfrom
hi-ogawa:10-05-feat_vite_add_experimental.ssrassets_for_assets_query_import

Conversation

@hi-ogawa
Copy link
Contributor

@hi-ogawa hi-ogawa commented Oct 16, 2025

🔗 Linked issue

❓ Type of change

  • 📖 Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

This PR add ?assets import support proposed in vitejs/vite#20913. It's enabled by default but added experimental.assetsImport to be able to disable in case something goes wrong.

I tested on nitrojs/vite-examples#5 and removed @hiogawa/vite-plugin-fullstack from Vue router example.

I also added examples/vite-assets for quick testing, but feel free to remove if it's unnecessary.

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@vercel
Copy link

vercel bot commented Oct 16, 2025

@hi-ogawa is attempting to deploy a commit to the Nitro Team on Vercel.

A member of the Team first needs to authorize it.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 16, 2025

Open in StackBlitz

npm i https://pkg.pr.new/nitrojs/nitro@3662

commit: ccc8545

hi-ogawa added a commit to hi-ogawa/vite-plugins that referenced this pull request Oct 16, 2025
See updated readme / docs. This reduces the need of accessing `@hiogawa/vite-plugin-fullstack/runtime`.

This would help when internalizing entire plugin inside Nitro
- nitrojs/nitro#3662
@hi-ogawa hi-ogawa force-pushed the 10-05-feat_vite_add_experimental.ssrassets_for_assets_query_import branch from 62cc20b to e9c0cff Compare October 16, 2025 14:35
hi-ogawa added a commit to hi-ogawa/vite-plugins that referenced this pull request Oct 16, 2025
We can inject its own `vite-plugin-fullstack/types` inside `vite-plugin-fullstack`. This also reduce the need of accessing `vite-plugin-fullstack/types` for many cases.

This would help when internalizing entire plugin inside Nitro
- nitrojs/nitro#3662

---

Hmm, it doesn't look like this is actually helping for Nitro.
hi-ogawa added a commit to hi-ogawa/nitro-vite-examples that referenced this pull request Oct 16, 2025
@hi-ogawa hi-ogawa changed the title feat(vite): add experimental.assetsImport option feat(vite): support ?assets import Oct 16, 2025
hi-ogawa added a commit to hi-ogawa/vite-plugins that referenced this pull request Oct 16, 2025
This allows a way to avoid rather inflexible `buildApp` hook and let users / downstream integration to invoke `writeAssetsManifest` at the appropriate timing. This will help nitrojs/nitro#3662

## todo

- [x] docs
- [x] tests
hi-ogawa added a commit to hi-ogawa/vite-plugins that referenced this pull request Oct 16, 2025
This is nice for dynamic client entry, but this can be disabled for Nitro for now to avoid a slightly annoying log when the app is server only nitrojs/nitro#3662

```
◐ Building [Client]                                                                                  nitro 12:51:18 AM
vite v7.1.10 building for production...
✓ 1 modules transformed.
Generated an empty chunk: "__fallback".
✓ built in 23ms
```
@hi-ogawa hi-ogawa marked this pull request as ready for review October 16, 2025 16:14
@hi-ogawa hi-ogawa requested a review from pi0 as a code owner October 16, 2025 16:14
Copy link
Member

@pi0 pi0 left a comment

Choose a reason for hiding this comment

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

🔥 🔥 🔥

@pi0 pi0 merged commit 4718bf7 into nitrojs:main Oct 24, 2025
5 of 6 checks passed
@hi-ogawa hi-ogawa deleted the 10-05-feat_vite_add_experimental.ssrassets_for_assets_query_import branch October 28, 2025 02:26
hi-ogawa added a commit to hi-ogawa/vite-plugin-fullstack that referenced this pull request Dec 18, 2025
See updated readme / docs. This reduces the need of accessing `@hiogawa/vite-plugin-fullstack/runtime`.

This would help when internalizing entire plugin inside Nitro
- nitrojs/nitro#3662
hi-ogawa added a commit to hi-ogawa/vite-plugin-fullstack that referenced this pull request Dec 18, 2025
We can inject its own `vite-plugin-fullstack/types` inside `vite-plugin-fullstack`. This also reduce the need of accessing `vite-plugin-fullstack/types` for many cases.

This would help when internalizing entire plugin inside Nitro
- nitrojs/nitro#3662

---

Hmm, it doesn't look like this is actually helping for Nitro.
hi-ogawa added a commit to hi-ogawa/vite-plugin-fullstack that referenced this pull request Dec 18, 2025
This allows a way to avoid rather inflexible `buildApp` hook and let users / downstream integration to invoke `writeAssetsManifest` at the appropriate timing. This will help nitrojs/nitro#3662

## todo

- [x] docs
- [x] tests
hi-ogawa added a commit to hi-ogawa/vite-plugin-fullstack that referenced this pull request Dec 18, 2025
This is nice for dynamic client entry, but this can be disabled for Nitro for now to avoid a slightly annoying log when the app is server only nitrojs/nitro#3662

```
◐ Building [Client]                                                                                  nitro 12:51:18 AM
vite v7.1.10 building for production...
✓ 1 modules transformed.
Generated an empty chunk: "__fallback".
✓ built in 23ms
```
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