How to use preinstalled node modules from laravel-elixir in Laravel 5

509 views Asked by At

Laravel elixir already comes with bunch of its own dependent node modules. How to use that modules instead of creating dependency in the root package.json.

For example, I want to use "del" package which is already there in /node_modules/laravel-elixir/node_modules/del, so rather than mentioning it on the /package.json, how can use this one?

1

There are 1 answers

0
MartinJH On

You could try to set up your gulp file like this:

var gulp            = require('gulp'),
    del             = require('del');

gulp.task('default', function() {
});

gulp.task('watch', function() {
    gulp.watch('resources/**', ['default']);
    elixir(function(mix) {
        //Standard elixir code
    });
});

Do note typing $ gulp in cli won't do anything anymore, unless you define something in the default task. $ gulp watch will work as always though.

I have no idea if this works without first requiring the dependency in package.json, but give it a try :)