How do you include /node_modules in a laravel 5.5 application, i referenced this https://laravel.com/docs/5.5/mix
i can do this
npm install angular-moment moment --save
and it will make a /node_modules directory, however laravel ignores it
lets say i want to do this
<script src="node_modules/moment/moment.js"></script>
it will not work, it will show an error
i currently have this in my webpack, what will be the best way to integrate it ?
let mix = require('laravel-mix');
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Laravel application. By default, we are compiling the Sass
| file for the application as well as bundling up all the JS files.
|
*/
mix.js('resources/assets/js/app.js', 'public/js')
.sass('resources/assets/sass/app.scss', 'public/css');
Just include it in your app.js so it is complied in...
var moment = require('moment');
Then access it as moment... like
moment().format();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With