We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 79048a6 commit 177194fCopy full SHA for 177194f
lib/template-compiler/modules/transform-require.js
@@ -22,6 +22,10 @@ module.exports = (userOptions, fileOptions) => {
22
}
23
24
25
+function getPathBaseOnSrc (a, b) {
26
+ return relative(a, b).replace(/^src\//, '')
27
+}
28
+
29
function transform (node, options, fileOptions) {
30
for (var tag in options) {
31
if (node.tag === tag && node.attrs) {
@@ -43,9 +47,9 @@ function rewrite (attrsMap, name, fileOptions) {
43
47
var { resourcePath, outputPath, context } = fileOptions
44
48
var assetPath = path.resolve(resourcePath, '..', value)
45
49
// 资源路径, 为了分包,去掉了 src 目录
46
- var toPath = relative(context, assetPath).replace(/^\/src\//, '')
- attrsMap[name] = path.join(outputPath, toPath)
- copyAsset(assetPath, attrsMap[name])
50
+ var toPath = getPathBaseOnSrc(context, assetPath)
51
+ attrsMap[name] = relative(getPathBaseOnSrc(context, resourcePath), getPathBaseOnSrc(context, assetPath))
52
+ copyAsset(assetPath, path.join(outputPath, toPath))
53
54
55
package.json
@@ -1,6 +1,6 @@
1
{
2
"name": "mpvue-loader",
3
- "version": "1.1.1",
+ "version": "1.1.2-rc.2",
4
"description": "mpvue single-file component loader for Webpack",
5
"main": "index.js",
6
"repository": {
0 commit comments