Jun 7, 2017
0
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')
Please or to participate in this conversation.