Search code examples
gruntjsuglifyjs

Grunt multi-tasks throwing EISDIR error when building


I am trying to set up grunt to minify a number of js files in a src directory and copy them to a build directory. Following the grunt task documentation, I believe the below configuration should work.

uglify: {
    dist: {
      files: [
        {
          expand: true,     // Enable dynamic expansion.
          cwd: 'src/js/',   // Src matches are relative to this path.
          src: ['**/?.js'], // Actual pattern(s) to match.
          dest: 'build/minified/',   // Destination path prefix.
          ext: '.min.js'    // Dest filepaths will have this extension.
        }
      ]
    }
  }

When I run grunt I get the message

Running "uglify:dist" (uglify) task Warning: Unable to write "build/minified" file (Error code: EISDIR). Use --force to continue.

If I switch the definition to use manual file paths it works fine. Is the documentation incorrect? or am I using it wrong?

I am running grunt v0.4.0rc2


Solution

  • Update grunt and replace src: ['**/?.js'] with src: ['**/*.js']

    For more information see the guide on globbing patterns.