-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
fix(webpack5-runner): 修复 imageUrlLoaderOption 配置项失效问题 #13014
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 similar comments
@beezen 印象中小程序的 background-image 只能支持 base64 的样子,这样的话小程序的 postcss-url 还是有必要的,可以测试下~ |
@Chen-jj 奥奥 之前确实忽略了。 小程序端确实是还得保留默认的 inline 设置 ; 不过因为不同的小程序端底层的处理方式有区别,有些小程序其实能够支持本地路径的调用,现在这个逻辑对开发者来说有一点黑盒,感觉可以在文档那边添加一个 postcss.url 配置说明。 |
小程序端保持 postcss-url 默认 inline 配置
Chen-jj
approved these changes
Jan 17, 2023
感谢贡献~ |
我们改的还是不对,postcss-url 插件最重要的用途是修正 @import 的资源路径,是一定需要开启的。应该将 inline 模式改为 rebase 模式,然后交给 webpack asset module 处理。 |
Chen-jj
added a commit
that referenced
this pull request
Feb 16, 2023
18 tasks
Chen-jj
added a commit
that referenced
this pull request
Feb 17, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
这个 PR 做了什么? (简要描述所做更改)
修复 imageUrlLoaderOption 配置项失效问题。
【详细说明】
升级到webpack5之后,我们提供了 mini.imageUrlLoaderOption 和 h5.imageUrlLoaderOption 这样的配置来设置针对图片的 url-loader 的配置。
但是,这个配置目前是不生效的,原因是我们以前的 postcss-url 插件中默认配置是设置了 url inline 模式,即所有的图片已经被内联为 base64了,这就导致在 imageUrlLoaderOption 配置解析时,无法匹配到图片路径格式,即功能失效。
因为两边的配置功能基本雷同,建议默认关闭 postcss-url 中的设置,同时也是因为 postcss-url 的配置也没有在文档中对外公开。
这个 PR 是什么类型? (至少选择一个)
这个 PR 涉及以下平台: