Home>

Development using vue.js and LaravelSo why do Javascript files have to be compiled by Laravel Mix?
For development using only javascriptmix.js ('resources/js/app.js','public/js')I ran it in a browser without writing such compiling code, but why would I need it if I used Laravel?
I would appreciate your advice.

  • Answer # 1

    Laravel MixI found that is a necessary function to compile files such as vue files and SCSS and apply them to the Laravel side (Blade).

  • Answer # 2

    The knowledge required to really master Laravel is actually the knowledge of the front desk rather than PHP.
    Let's move away from Laravel first and learn about modern JavaScript and CSS.
    It is no longer common sense to build and use with webpack.
    Laravel mix is ​​only a wrapper for webpack, so if you know ↑, you can use it without any doubt.

    In reality, veterans who have used other PHP frameworks before Laravel have less knowledge of this front desk, so they often do not use mix.
    If you come across a Laravel project that puts jquery.min.js in public/and writes JS directly in blade, you should run away immediately.

    The Laravel documentation doesn't force you to use a mix.
    But if you are involved in the web in modern times, you cannot escape from this front desk learning.

  • Answer # 3

    You need to compile JavaScriptVue.jsIt is the situation of the person. It's not "because it's Laravel".