Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ? to resourceQuery for Consistency with interpolateName Behavior #102

Merged
merged 3 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ Output name of the resource file, its usage aligns with the [`name`](https://git
- Example:
```typescript
libAssetsPlugin({
name: '[name].[contenthash:8].[ext]?[query]'
name: '[name].[contenthash:8].[ext][query]'
})
```
> The complete list can be found at [`loader-utils#interpolatename`](https://github.com/webpack/loader-utils#interpolatename)
Expand Down Expand Up @@ -127,7 +127,7 @@ Specify the output path where the extracted files will be placed.
outputPath: (url, resourcePath, resourceQuery) => {
// `url` - file name processed by the `name` option,eg: `logo.fb2133.png`
// `resourcePath` - `/original/absolute/path/to/file.js`
// `resourceQuery` - `foo=bar`
// `resourceQuery` - `?foo=bar`

return url.endsWith('.png') ? 'image' : 'assets'
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,6 @@
},
"volta": {
"node": "18.16.1",
"pnpm": "8.6.2"
"pnpm": "9.10.0"
}
}
3 changes: 2 additions & 1 deletion playground/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"private": true,
"scripts": {
"dev": "nodemon -w '../src/**/*.ts' -e .ts -x vite build"
"dev": "nodemon -w '../src/**/*.ts' -e .ts -x vite build",
"build": "vite build"
},
"dependencies": {
"@fontsource-variable/raleway": "^5.0.18",
Expand Down
Binary file added playground/src/assets/chrome-file.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions playground/src/async.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import './async.css'
import png from './assets/chrome-file.png'

export const pngUrl = png

// eslint-disable-next-line no-console
export default () => console.log('I\'m an async module')
4 changes: 4 additions & 0 deletions playground/src/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ declare module '*.svg' {
const src: string;
export default src;
}
declare module '*.png' {
const src: string;
export default src;
}

declare module '*.vue' {
import { defineComponent } from 'vue'
Expand Down
Binary file added playground/src/styles/assets/chrome-css.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions playground/src/styles/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
.themes-red {
background: url('./assets/vite-logo-css-local.svg') no-repeat left top / cover;
}
.themes-blue {
background: url('./assets/chrome-css.png') no-repeat left top / cover;
}
Loading
Loading