Skip to content

修复无法引入相对路径资源的bug #16

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

Merged
merged 6 commits into from
May 4, 2018

Conversation

steinslin
Copy link
Member

相关issue

  • src/platforms/mp/compiler/codegen/generate.js中可以看到,是使用attrsMap来生成wxml的,所以这里需要重写的属性应该是attrsMap

  • 由于是生成wxml文件,无法再让webpack处理图片等资源,不同vue-loader,所以这里将通过相对路径引入的资源拷贝到webpack的输出目录下

@F-loat
Copy link
Member

F-loat commented Apr 29, 2018

小程序里使用相对路径主要还是为了转 base64 吧,不然可以直接放在 static 目录里的

@steinslin
Copy link
Member Author

steinslin commented Apr 29, 2018

也想过转base64,这里应该无法借助url-loader file-loader,转base64也要自己转,这样需要多一个配置类似url-loader的limit,而且可能在资源的处理上只能使用同步的api了吧

@F-loat
Copy link
Member

F-loat commented Apr 29, 2018

还没仔细看 mpvue-loader 的原理,所以不太理解为什么一些 vue-loader 的特性会不支持了,比如路径这个还有 template, script 和 style 标签的 src 属性等,感觉这些东西的处理上应该是一样的啊

@steinslin steinslin changed the base branch from master to develop May 1, 2018 14:07
@aOrz aOrz merged commit fdae6ff into mpvue:develop May 4, 2018
@aOrz
Copy link
Contributor

aOrz commented May 4, 2018

已经 revert 了,在图片被转成 base64 之后,依然 copy 了图片到 dist 目录下,还有些问题

BugKun pushed a commit to BugKun/mpvue-loader that referenced this pull request Jun 1, 2020
修复无法引入相对路径资源的bug
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants