Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

jijoel's avatar
Level 10

Transpiling imported ES6 node_module files for IE11 support

Have you wanted to import some functionality from a node module into one of your Vue components? Simple enough to do, but if the module you're importing uses ES6, visitors using Internet Explorer will get javascript errors, and won't be able to access your pages.

Fortunately, we have an easy solution for that via Laravel Mix. Just build the Javascript in a temporary workspace, and then transpile it to our ultimate app.js file using the .babel method. In webpack.mix.js:

mix.js('resources/assets/js/app.js', '../storage/work/temp.js')
   .babel(['storage/work/temp.js'], 'public/js/app.js')
0 likes
0 replies

Please or to participate in this conversation.