解决webpack5上使用art-template出现“can‘t resoleve ‘....libruntime.js‘“错误的办法

解决webpack5上使用art-template出现“can‘t resoleve ‘....libruntime.js‘“错误的办法,第1张

解决webpack5上使用art-templates时,出现"can‘t resoleve '....\lib\runtime.js'"错误的办法 前言问题再现解决办法问题解决参考来源:

前言

本人是一个web新手,在webpack使用art-template时,出现了"can’t resoleve ‘…\lib\runtime.js’''的问题,研究了很久很久,不得不说,百度这个东西除了搜索套娃文章和广告,真是…啥也不是.

问题再现

在webpack使用art-template编译时,出现了类似如下错误:

ERROR in   Error: Child compilation failed:
  Module not found: Error: Can't resolve '..\..\node_modules\art-template\lib\runtime.js' in 'D:\xxx\xxx\xxxx'
  Did you mean './..\..\node_modules\art-template\lib\runtime.js'?
  Requests that should resolve in the current directory need to start with './'.
  Requests that start with a name are treated as module requests and resolve within module directories (node_modules).
	......

当时看上去可能是路径或者node_modules出现了问题, 经过多次测试排除, 又换webpack和art-template版本…一系列 *** 作后总结发现三点问题:

所有art文件在根目录第一层文件夹下,比如’./src/xxx.art’, 或者’./components/xxx.art’,就不会出错.问题只出现在新版webpack上,也有可能是template,或者他们俩都有问题.忘记了,大概是这样.也许是win11或者win10下独有问题

研究了好久,又查百度,还是没找到解决办法就放弃了,过了一段时间又感觉不找到解决办法还是难受,间接导致阳痿早泄…想起google,github搜一下…终于找到了解决办法

解决办法

已知解决此问题无效的方法: 全局安装npm -g i art-template

把node_modules\art-template里的lib文件夹拷贝到项目所在磁盘根目录,比如你的项目在c盘,要保证能有c:\node_modules\art-template\lib可以访问.

问题解决参考来源:

https://github.com/aui/art-template/issues/629

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1296194.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-10
下一篇 2022-06-10

发表评论

登录后才能评论

评论列表(0条)

保存