intlify / intlify/bundle-tools

.yaml glob imports no longer support aliases in wildcards

Open
#611 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
270
Forks
46
PR merge metrics
No merged PRs in 30d

Description

### Reporting a bug?

In previous versions of the plugin, I could import my lang files using a glob import like this:

```js
import.meta.glob('@/lang/*.yaml')
```

Now, after upgrading this plugin to a new version, I get the following error:

```
[plugin builtin:vite-import-glob] Invalid glob pattern: `@/lang/*.yaml` (resolved: `virtual:intlify-i18n-0`) in file 'src/main.ts'. Glob patterns must start with:
• '/' for absolute paths from project root
• './' or '../' for relative paths
• '**/' for recursive matching from project root
• '#' for subpath imports (with '*' wildcard)
```

### Expected behavior

It should work like before.

### Reproduction

You can find a minimal Vue + Vue-18n app here, with the issue failing in CI (and working before upgrading to the most recent version): https://github.com/NoelDeMartin/reproductions/tree/intlify-i18n-aliases

### Issue Package

unplugin-vue-i18n

### System Info

```shell
Happening in Github CI with `ubuntu-latest`, see: https://github.com/NoelDeMartin/reproductions/actions/runs/35115966562/job/104861344863
```

### Screenshot

_No response_

### Additional context

Trying to troubleshoot this, it seems like the regression can be traced back to this PR: https://github.com/intlify/bundle-tools/pull/565

### Validations

- [x] Read the [Contributing Guidelines](https://github.com/intlify/bundle-tools/blob/main/CONTRIBUTING.md).
- [x] Read the README
- [x] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [x] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/intlify/bundle-tools/discussions).

Contributor guide

Open the contributing guide

Research direction

Start with the reproduction's src/main.ts and compare the glob-handling change linked in PR 565. Run the reproduction's GitHub Actions workflow, then verify that import.meta.glob('@/lang/*.yaml') is accepted and the CI job passes as it did before the upgrade.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vite
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.