Nope.
The only reason you should have javascript in a blade template is because you're passing variables from PHP.
There's no way that can be compiled anywhere other than at run time.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Is it possible to transpile javascript code that is inside a blade.php file?
I have some JS at the end of a blade.php template and i would like to use import * from 'somemodule' but i cannot as it seems the JS code within blade files does not get transpiled.
Being able to import a JS class into a specific blade template would really help unless there is an alternative method. I am able to import js classes into vue templates thanks to the webpack vue loader but nothing similar seems to exist for blade templates
Please or to participate in this conversation.