How to connect your node_modules using webpack in laravel?

Here is the code webpack
let mix = require('laravel-mix');

 mix.js('resources/assets/js/app.js', 'public/js')
 .sass('resources/assets/sass/app.scss', 'public/css');


and here is the code app.js

require('./bootstrap');

require ( 'sweet-modal' );

require('./scripts');


and error 5a313a4d7ab07893061800.png
June 10th 19 at 15:23
1 answer
June 10th 19 at 15:25
Solution
Try to require to add the full path to the script, for example:
require ( 'sweet-modal/dist/min/jquery.sweet-modal.min.js' );
hmm.. strange, but it works - westley45 commented on June 10th 19 at 15:28

Find more questions by tags Webpack