art-template, node_modules doesn‘t exist or is not a directory

24 篇文章 0 订阅
23 篇文章 0 订阅
文章描述了在使用Webpack时遇到的错误,涉及到runtime.js模块不存在以及browser配置中的alias问题。解决方案是修改webpack.prod.config.js文件,增加`preferRelative:true`以优先查找相对路径的模块。
摘要由CSDN通过智能技术生成

\art-template\lib\runtime.js doesn't exist

Parsed request is a module
using description file: d:\player\package.json (relative path: ./src/template)
  Field 'browser' doesn't contain a valid alias configuration
  resolve as module
    d:\player\src\template\node_modules doesn't exist or is not a directory
    d:\player\src\node_modules doesn't exist or is not a directory
    looking for modules in d:\player\node_modules
      single file module
        No description file found in d:\\node_modules\art-template\lib or above
        no extension
          Field 'browser' doesn't contain a valid alias configuration
          d:\\node_modules\art-template\lib\runtime.js doesn't exist
        .js
          Field 'browser' doesn't contain a valid alias configuration
          d:\\node_modules\art-template\lib\runtime.js.js doesn't exist
        .less
          Field 'browser' doesn't contain a valid alias configuration
          d:\\node_modules\art-template\lib\runtime.js.less doesn't exist
      d:\\node_modules\art-template\lib\runtime.js doesn't exist
    d:\node_modules doesn't exist or is not a directory
    d:\node_modules doesn't exist or is not a directory
    d:\node_modules doesn't exist or is not a directory
    d:\node_modules doesn't exist or is not a directory

解决办法:

修改webpack配置文 webpack\prod.config.js 

resolve: {
        modules: ['node_modules'],
        extensions: ['.js', '.less'],
        fallback: {
            dgram: false,
            fs: false,
            net: false,
            tls: false,
        },
		preferRelative: true,
    },

添加了一行 :preferRelative: true,

  • 6
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值