Skip to content

Conversation

@patak-dev
Copy link
Member

@patak-dev patak-dev commented Jun 5, 2025

fixes #17453

Description

This is basically #18510 removing the partial base plus alias support and clarifying docs. Aliases can start with any char, not only @. I couldn't find a good way to support them, and I think we could release the feature to unblock SvelteKit if they only need non-aliased bases. @dominikg @benmccann could you clarify if this is the case?

Added these clarifications to the docs:

The base option can only be a dir path relative to the importer file or absolute against the project root. Aliases and virtual modules aren't supported.

Only the globs that are relative paths are interpreted as relative to the resolved base.

All the resulting module keys are modified to be relative to the base if provided.

We don't support full resolution in globs already. If the path start with . or / we don't resolve them for example, so it seems support for aliases and virtual modules is already partial without taking into account the base.

Sending this as separate PR to avoid modifying the other PR that has a discussion about how to support alias and virtual modules, and we may want to continue that. There is also a proposal to refactor the code but IIUC, that isn't needed if we only need to support what the docs in this PR describe.

Co-authored-by: Ben McCann <[email protected]>
benmccann
benmccann previously approved these changes Jun 5, 2025
Copy link
Collaborator

@benmccann benmccann left a comment

Choose a reason for hiding this comment

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

amazing! thank you!

alias support would be a nice-to-have. I wouldn't block this PR on it, but it would be nice to add in some future release

Making a note for myself in case we come back to try to add the feature later, it seems one of the difficulties is that resolveId only works with files today whereas we need a directory for import.meta.glob: #18510 (comment)

sapphi-red
sapphi-red previously approved these changes Jun 6, 2025
Copy link
Member

@sapphi-red sapphi-red left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@sapphi-red sapphi-red added enhancement New feature or request p2-nice-to-have Not breaking anything but nice to have (priority) labels Jun 6, 2025
@patak-dev patak-dev dismissed stale reviews from sapphi-red and benmccann via 50b5723 June 6, 2025 09:02
@sapphi-red
Copy link
Member

/ecosystem-ci run

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jun 7, 2025

Open in StackBlitz

npm i https://pkg.pr.new/vite@20163

commit: 8c3f886

@vite-ecosystem-ci
Copy link

📝 Ran ecosystem CI on 8c3f886: Open

suite result latest scheduled
astro failure failure
analogjs failure failure
histoire failure failure
previewjs failure failure
vike failure failure
vite-plugin-cloudflare failure failure
sveltekit success failure

nuxt, ladle, laravel, marko, qwik, rakkas, quasar, react-router, vite-plugin-vue, vite-plugin-pwa, unocss, vite-plugin-svelte, vuepress, vite-setup-catalogue, vite-environment-examples, waku, storybook, vite-plugin-react, vitest, vitepress

@sapphi-red sapphi-red merged commit 253d6c6 into main Jun 10, 2025
35 of 37 checks passed
@sapphi-red sapphi-red deleted the feat/add-base-option-to-import-meta-glob branch June 10, 2025 01:37
shulaoda added a commit to rolldown/rolldown that referenced this pull request Jun 21, 2025
github-merge-queue bot pushed a commit to rolldown/rolldown that referenced this pull request Jun 21, 2025
hyf0 pushed a commit to rolldown/rolldown that referenced this pull request Jun 22, 2025
## [1.0.0-beta.19] - 2025-06-22

### 🚀 Features

- support `OutputOptions#manualChunks` (#5037) by @hyf0
- advanced-chunks: support `advancedChunks#gruop#name` to be function
(#5035) by @hyf0
- rolldown_plugin_import_glob: align with `vitejs/vite#20163` (#5034) by
@shulaoda
- rust/advanced-chunks: support `MatchGroup#name` to be dynamic (#5033)
by @hyf0
- rolldown_plugin_build_import_analysis: align with `vitejs/vite#20117`
(#5027) by @shulaoda
- rolldown_plugin_build_import_analysis: align with `vitejs/vite#20115`
(#5020) by @shulaoda
- add validation warning for advanced chunks options without groups
(#5009) by @sapphi-red

### 🐛 Bug Fixes

- moduleInfo is not updated when entry module is emitted by
this.emitFile (#5032) by @IWANABETHATGUY
- preserveEntrySignatures: false generates circular imports that hangs
with TLA (#5029) by @IWANABETHATGUY
- rolldown_plugin_build_import_analysis: align pure dynamic import
handling with rolldown-vite (#5016) by @shulaoda
- plugin/vite-resolve: normalize leading slash (#5013) by @sapphi-red
- debug: `build_id` doesn't increase (#5015) by @hyf0
- side effects in this.emitFile({ type: 'chunk' }) is removed when
preserveEntrySignatures: false is set (#5012) by @IWANABETHATGUY

### 🚜 Refactor

- rolldown_utils: simplify `block_on_spawn_all` (#5019) by @shulaoda
- use `rolldown_utils::futures::block_on` for `WatcherImpl#start`
(#5018) by @shulaoda

### 📚 Documentation

- jsdoc: document `experimental.attachDebugInfo` (#5028) by @hyf0
- clarify that `advancedChunks` options are in bytes (#5022) by
@sapphi-red
- add a note that sequential conversion may break the code (#5024) by
@sapphi-red

### ⚙️ Miscellaneous Tasks

- infra: clean up `dist` before building `rolldown` (#5036) by @hyf0
- Align status notice in readme with documentation (#5021) by
@rijkvanzanten

### ❤️ New Contributors

* @rijkvanzanten made their first contribution in
[#5021](#5021)

Co-authored-by: shulaoda <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request p2-nice-to-have Not breaking anything but nice to have (priority) trigger: preview

Projects

None yet

Development

Successfully merging this pull request may close these issues.

base or cwd option for import.meta.glob

5 participants