webpack在编译typescript报错

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

发表评论

发表评论