Skip to content

Commit ef093e9

Browse files
committed
fix: 图片引用问题
1 parent 177194f commit ef093e9

File tree

3 files changed

+2
-3
lines changed

3 files changed

+2
-3
lines changed

lib/mp-compiler/util.js

-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ function getCompNameAndSrc (context, file) {
3131
function getNameByFile (dir) {
3232
// const arr = dir.match(/[pages?/components?]\/(.*?)(\/)/)
3333
const arr = dir.match(/pages\/(.*?)\//)
34-
// 兼容 win 下的路径格式不统一的问题
3534
if (arr && arr[1]) {
3635
return arr[1]
3736
}

lib/template-compiler/modules/transform-require.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ function rewrite (attrsMap, name, fileOptions) {
4848
var assetPath = path.resolve(resourcePath, '..', value)
4949
// 资源路径, 为了分包,去掉了 src 目录
5050
var toPath = getPathBaseOnSrc(context, assetPath)
51-
attrsMap[name] = relative(getPathBaseOnSrc(context, resourcePath), getPathBaseOnSrc(context, assetPath))
51+
attrsMap[name] = `/${toPath}`
5252
copyAsset(assetPath, path.join(outputPath, toPath))
5353
}
5454
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mpvue-loader",
3-
"version": "1.1.2-rc.2",
3+
"version": "1.1.2-rc.3",
44
"description": "mpvue single-file component loader for Webpack",
55
"main": "index.js",
66
"repository": {

0 commit comments

Comments
 (0)