提交 d5e4449b 编写于 作者: H huyuangang 提交者: yylgit

fixbug

wxml
上级 479d4304
......@@ -19,7 +19,7 @@ module.exports = function(loaderContext, jsonObject, cmlType) {
}
cmlUtils.addNpmComponents(jsonObject, jsonPath, cmlType, context)
return jsonObject;
......
......@@ -678,7 +678,6 @@ _.handleComponentUrl = function (context, cmlFilePath, comPath, cmlType) {
refUrl
}
}
if (~filePath.indexOf('node_modules')) {
refUrl = _.npmComponentRefPath(filePath, context);
// 改为相对路径
......@@ -687,18 +686,18 @@ _.handleComponentUrl = function (context, cmlFilePath, comPath, cmlType) {
} else {
// 改成相对路径
refUrl = _.handleRelativePath(cmlFilePath, filePath);
}
refUrl = refUrl.replace(new RegExp(`(\\.cml|\\.${cmlType}\\.cml)`), '');
if (cmlType === 'wx') {
refUrl = refUrl.replace(/\.wxml/g, '');
}
if (cmlType === 'alipay') {
refUrl = refUrl.replace(/\.axml/g, '');
}
refUrl = refUrl.replace(new RegExp(`(\\.cml|\\.${cmlType}\\.cml)`), '');
if (cmlType === 'wx') {
refUrl = refUrl.replace(/\.wxml$/g, '');
}
if (cmlType === 'alipay') {
refUrl = refUrl.replace(/\.axml$/g, '');
}
if (cmlType === 'baidu') {
refUrl = refUrl.replace(/\.swan/g, '');
}
if (cmlType === 'baidu') {
refUrl = refUrl.replace(/\.swan$/g, '');
}
return {
......
......@@ -365,6 +365,22 @@ describe('index.js', function () {
expect(result.isCml).to.equal(true);
})
it('handleComponentUrl isCml true wxml', function() {
global.cml = {};
_.setCli(true);
cml.config = require('./testlib/cli/config.js');
cml.utils = require('../src/index.js');
cml.projectRoot = path.join(__dirname, 'testlib/demo-project');
cml.config.merge({
})
var cmlFilePath = path.join(__dirname, 'testlib/demo-project/src/pages/page1/page1.cml');
var comrefPath = 'vant-weapp/test'
let result = _.handleComponentUrl(cml.projectRoot, cmlFilePath, comrefPath, 'wx');
expect(result.refUrl).to.equal('./../../npm/vant-weapp/test');
})
it('findInterfaceFile', function() {
global.cml = {};
_.setCli(true);
......
......@@ -33,7 +33,7 @@ module.exports = function (options) {
]
}
if (media === 'export') {
return getMiniAppExportConfig(options);
return getMiniAppExportConfig(merge(commonConfig, buildConfig), options);
}
return merge(commonConfig, buildConfig)
}
......@@ -27,7 +27,7 @@ var miniappConfig = {
'process.env.NODE_ENV': JSON.stringify('production')
},
entry: [
'./components'
'./src/components'
],
publicPath: '../../'
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册