6

I am trying to include this module: https://www.npmjs.com/package/react-datepicker-component with react into my Laravel Framework.

I went on to using npm to install it but I am getting no where after that.

I could use some direction. Has anyone tried using NPM for Laravel other than for Laravel Elixir?

0

1 Answer 1

4

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Interesting. I have am alternative solution using Webpack to compile the packages (installed through NPM) into a single javascript file. I then just linked that single file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.