-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
windows 下运行 webpack 5,使用 art-template-loader 路径解析出现错误 #633
Comments
我这边升级到webpack 5也无法使用了,我也是Windows,只能先本地解决一下,希望作者尽快更新吧~ |
@aui 大佬在吗。。 |
使用中,解析路径确实出现问题, |
为了不移动或者修改其它的东西,可以先弄个简单的loader,解决window下路径分割符的问题,只不过只处理了这个一个文件, // fix-template-loader.js
module.exports = function (source) {
return source.replace(/(require.*node_modules[/\\]+art-template[/\\]+lib[/\\]+runtime.js)/g,(word)=>{
return word.replace(/[/\\]+/g,'/');
});
}; // webpack.config.js
......
{
test: /\.tpl$/,
use: [
{
loader: path.resolve('./loader/fix-template-loader.js'),
},
{
loader: 'art-template-loader',
},
],
},
....... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
如果 .art 文件放在 node_modules 上会导致路径解析出现问题。
测试过 *nix 下系统都不会有问题,只有 windows 出现这个问题。
我在 art-template 的包上改过了,只需要把 precompile.js 的
tplImportsPath
使用 slash 包统一一下路径就能正确运行。https://github.com/aui/art-template/blob/master/src/precompile.js#L249
重现问题仓库请看
https://github.com/kamilic/atl-production
如果有需要提交 PR,我可以进行修改。
The text was updated successfully, but these errors were encountered: