前言
我是一个新手,在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,或