webpack在编译typescript报错

  • A+
所属分类:前端工程

webpack在编译typescript报错

ERROR in ./src/main.ts
Module build failed: Error: You may be using an old version of webpack; please check you're using at least version 4
    at successfulTypeScriptInstance (F:\APP\html\demo\typescript-demo\node_modules\ts-loader\dist\instances.js:144:15)
    at Object.getTypeScriptInstance (F:\APP\html\demo\typescript-demo\node_modules\ts-loader\dist\instances.js:34:12)
    at Object.loader (F:\APP\html\demo\typescript-demo\node_modules\ts-loader\dist\index.js:17:41)

出现这个错误是由于ts-loader的版本不正确

修改ts-loader版本

使用 ts-loader v3.5

npm install ts-loader@3.5.* --save-dev

主要是laravel-mix不支持webpack 4

  • 公众号
  • 扫一扫
  • weinxin
  • 打赏
  • 扫一扫
  • weinxin

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: