What will happen if two plugins provide task with the same name in Grunt?

48 views Asked by At

For example, both grunt-contrib-requirejs and grunt-requirejs provide a task called requirejs. What will happen if I installed two plugins? Which plugin will be used to run the task?

1

There are 1 answers

0
Timusan On BEST ANSWER

It depends on the order in which you define your grunt.loadNpmTasks() calls:

grunt.loadNpmTasks('grunt-requirejs');
grunt.loadNpmTasks('grunt-contrib-requirejs');

Will overwrite the grunt-requirejs and load the grunt-contrib-requirejs version, where as:

grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.loadNpmTasks('grunt-requirejs');

Will overwrite the grunt-contrib-requirejs and load the grunt-requirejs version.

To see which one gets called (in which order) when you run, you can call Grunt with the -v flag to make it`s output more verbose.

Also remember, never be afraid to poke it with a stick and see what happens!