Brand new Laravel project. Trying to compile a JavaScript file using TypeScript. Throws the following error:
ERROR in ./resources/assets/js/src/order.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 (C:\Users\MartinBean\Developer\TypeScriptTest\node_modules\ts-loader\dist\instances.js:168:15)
at Object.getTypeScriptInstance (C:\Users\MartinBean\Developer\TypeScriptTest\node_modules\ts-loader\dist\instances.js:51:12)
at Object.loader (C:\Users\MartinBean\Developer\TypeScriptTest\node_modules\ts-loader\dist\index.js:16:41)
@ ./resources/assets/js/app.js 1:0-32
@ multi ./resources/assets/js/app.js ./resources/assets/sass/app.scss
composer create-project laravel/laravel).{
"include": [
"resources/assets/js/**/*"
]
}
mix.ts('resources/assets/js/app.js', 'public/js')I don鈥檛 think I鈥檝e _ever_ got TypeScript to compile successfully. It would be good if the Mix documentation could be updated with the minimum options needed to get TypeScript to compile successfully.
You should be using ts-loader v3.5, update your package.json
Right now laravel-mix does not support webpack 4
@ankurk91 Thank you.
Hi @JeffreyWay, is there any way to specify the version of the typescript's dependencies (at this line) ?
Otherwise, upgrading webpack to v4 may solve the issue
Cheers
Most helpful comment
You should be using
ts-loader v3.5, update yourpackage.jsonRight now laravel-mix does not support webpack 4