Using node modules in Laravel Using node modules in Laravel reactjs reactjs

Using node modules in Laravel


I was stuck with this same issue for about an hour trying to pull in the inputmask node package.

The only way I was able to get it included was by attaching it to the window object in app.js (similar to what bootstrap.js does)

window.InputMask = require('inputmask');

If you don't want to load it every time (as it would with app.js) you can create a separate js file that contains only the line of code above and load that on select pages. I feel like there has to be a better way, but this is the only way I've found to make it work.