提交 4170c69d 编写于 作者: fxy060608's avatar fxy060608

fix(mp): windows path

上级 25df9880
......@@ -59,6 +59,17 @@ module.exports = function (content, map) {
}
}
if ( // windows 上 page-meta, navigation-bar 可能在不同盘上
/^win/.test(process.platform) &&
path.isAbsolute(resourcePath) &&
(
resourcePath.indexOf('page-meta') !== -1 ||
resourcePath.indexOf('navigation-bar') !== -1
)
) {
resourcePath = normalizePath(path.relative(process.env.UNI_CLI_CONTEXT, resourcePath))
}
if (!type) {
type = 'Component'
}
......
......@@ -4,6 +4,7 @@ const loaderUtils = require('loader-utils')
const {
removeExt,
normalizePath,
getPlatformExts,
getShadowTemplate
} = require('@dcloudio/uni-cli-shared')
......@@ -43,7 +44,19 @@ module.exports = function (content, map) {
if (vueLoaderOptions) {
const globalUsingComponents = getGlobalUsingComponents()
const realResourcePath = path.relative(process.env.UNI_INPUT_DIR, this.resourcePath)
const resourcePath = normalizeNodeModules(removeExt(realResourcePath) + templateExt)
let resourcePath = normalizeNodeModules(removeExt(realResourcePath) + templateExt)
if ( // windows 上 page-meta, navigation-bar 可能在不同盘上
/^win/.test(process.platform) &&
path.isAbsolute(resourcePath) &&
(
resourcePath.indexOf('page-meta') !== -1 ||
resourcePath.indexOf('navigation-bar') !== -1
)
) {
resourcePath = normalizePath(path.relative(process.env.UNI_CLI_CONTEXT, resourcePath))
}
const wxComponents = getWXComponents(resourcePath.replace(path.extname(resourcePath), ''))
const params = loaderUtils.parseQuery(this.resourceQuery)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册