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

[Feature]: Rspack能否支持,像vite那样,使用?raw标记,即可将资源文件转换为字符串 #7538

Closed
congxiaobai opened this issue Aug 12, 2024 · 5 comments
Labels
feat New feature or request pending triage The issue/PR is currently untouched.

Comments

@congxiaobai
Copy link

What problem does this feature solve?

某种场景下需要直接获取文本资源的内容

What does the proposed API of configuration look like?

import shaderString from './shader.glsl?raw'
@congxiaobai congxiaobai added feat New feature or request pending triage The issue/PR is currently untouched. labels Aug 12, 2024
@JSerFeng
Copy link
Contributor

yeah, try this

module.exports = {
  module: { rules: [ { resourceQuery: /?raw/, type: 'asset/source' } ] }
}

@congxiaobai
Copy link
Author

I tried this way。 But I did not get the correct content。
It lost some words.

@JSerFeng
Copy link
Contributor

Can you provide more details ?

@curlykay
Copy link

/?raw/

/?raw/ is a invalid regular expression, Maybe resourceQuery:/raw/.
image

Additionally, I also have a question about the rule.resourceQuery documentation--"how Rule.resourceQuery is ?raw"
image
like resourceQuery:'?raw' or resourceQuery:/\?raw/ ?

Perhaps in the doc, some brief snippet similar to webpack would be clearer.
image

Additional content might be more appropriate to be proposed as a new issue, please forgive me for raising it here.

@JSerFeng
Copy link
Contributor

Thanks, I'll correct it later !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat New feature or request pending triage The issue/PR is currently untouched.
Projects
None yet
Development

No branches or pull requests

3 participants