Feature: Update default include regex to support query parameters in file paths
enhancement
### Clear and concise description of the problem
Currently, the plugin's default `include` rule uses the regular expression `/\.[tj]sx?$/`. This strictly matches files ending with `.js`, `.jsx`, `.ts`, or `.tsx`.
However, in modern build tools and frameworks, it's very common for file imports to be appended with query parameters under the hood. A notable example is **TanStack Router**, which appends query parameters like `?tsr-split=component` to file paths for its code-splitting feature (see related issue: [TanStack/router#5653](https://github.com/TanStack/router/issues/5653)).
Because of the strict `$` at the end of the current regex, these files with query parameters fail to match the default `include` rule, causing the plugin to skip them unless users manually override the configuration.
### Suggested solution
I propose updating the default `include` regular expression to gracefully handle optional query parameters.
Changing it from:
```javascript
/\.[tj]sx?$/
```
To:
```javascript
/\.[tj]sx?(?:\?.*)?$/
```
### Alternative
_No response_
### Additional context
_No response_
### Validations
- [x] Follow our [Code of Conduct](https://github.com/unplugin/.github/blob/main/CODE_OF_CONDUCT.md)
- [x] Read the [Contributing Guide](https://github.com/antfu/contribute).
- [x] Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
0 条评论