Mix: Extract <script> in Blade-Views to single JS File
I would like to extract all JS-Code from Blade-Views to a single JS-File using Laravel Mix/Webpack.
Similar to how it works with Vue-Styles:
mix.js('src/app.js', 'js').vue({ extractStyles: 'css/vue-styles.css' });
I know this is not quite intended or best practice but I am curious to know if it is possible somehow.
My goal is to extract all JS inside Script-Tags of Blade Files within a defined folder into a single JS File.
Maybe someone has an idea or has done this before :)
https://laravel-mix.com/extensions/single-file-blade-components
This seems like exactly what a I needed but unfortuantely I cant install it with Mix 6:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/laravel-mix
npm ERR! dev laravel-mix@"^6.0.49" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer laravel-mix@"^5.0.0" from [email protected]
npm ERR! node_modules/single-file-blade-components
npm ERR! dev single-file-blade-components@"^0.0.1" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/laravel-mix
npm ERR! peer laravel-mix@"^5.0.0" from [email protected]
npm ERR! node_modules/single-file-blade-components
npm ERR! dev single-file-blade-components@"^0.0.1" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
Please or to participate in this conversation.