Soroush Hakami Soroush Hakami - 6 months ago 22
Node.js Question

grunt uglify task failing

When running grunt, I get the following error:


Warning: Unable to write "client/dist/js/build.js" file (Error code: undefined). Use --force to continue.


The config of uglify in my
Gruntfile.js
:

uglify: {
build: {
src: ['client/src/js/*.js'],
dest:['client/dist/js/build.js']
}
}


I'm using
grunt-contrib-uglify
.

Any ideas why this is happening?

Answer

Assuming your Grunt Version is 0.4.0, AFAIK you are not using the most recent Syntax (See https://github.com/gruntjs/grunt-contrib-uglify#usage-examples).

Try

uglify: {
    build: {
        files: {
            'client/dist/js/build.js': ['client/src/js/*.js']
        }
    }
}

I am also not sure if the wildcards are handled properly.