-
Notifications
You must be signed in to change notification settings - Fork 4.8k
开启半编译模式 —— CompileMode报错 #15252
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
Comments
@hcweb 麻烦提供一下demo |
解决了吗?同样的报错 |
目前我这也出现这个问题了,这个是因为windows下开启compileMode,template里面的相对路径会被编译成/导致引用路径找不到,只能先手动改成\才能正常访问,mac下是没有问题的。并且compileMode下引入的wxs相对路径在template模版里也是不对的。 |
想知道目前这个问题有进展嘛 |
一样的问题 |
问题在这里: taro/packages/taro-webpack5-runner/src/plugins/MiniCompileModePlugin.ts Lines 297 to 303 in 5b53c7c
windows系统下使用 临时解决可以找到这个文件 把 source.add(`<import src="${node_path_1.default.relative(node_path_1.default.dirname(key), `./${baseTemplName}`)}"/>\n`);
if (fileType.xs) {
const content = template.buildXsImportTemplate(node_path_1.default.relative(node_path_1.default.dirname(key), `./utils`));
source.add(content);
}
source.add(assets[key]); 改成 const repalceSeparator = (path) => {
return path.replace(/\\/g, '/');
};
source.add(`<import src="${repalceSeparator(node_path_1.default.relative(node_path_1.default.dirname(key), `./${baseTemplName}`))}"/>\n`);
if (fileType.xs) {
const content = template.buildXsImportTemplate(repalceSeparator(node_path_1.default.relative(node_path_1.default.dirname(key), `./utils`)));
source.add(content);
}
source.add(assets[key]); |
相关平台
微信小程序
小程序基础库: 3.3.3
使用框架: React
复现步骤
按照文档开启半编译模式 —— CompileMode报错
期望结果
开启半编译模式 —— CompileMode报错
实际结果
开启半编译模式 —— CompileMode报错
环境信息
The text was updated successfully, but these errors were encountered: