gruntjs - Grunt 多任务在构建时抛出 EISDIR 错误

标签 gruntjs uglifyjs

我正在尝试设置 grunt 来缩小 src 目录中的多个 js 文件并将它们复制到构建目录。继grunt task documentation ,我相信下面的配置应该可以工作。

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.
        }
      ]
    }
  }

当我运行 grunt 时,我收到消息

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

如果我将定义切换为使用手动文件路径,它可以正常工作。文档是否不正确?还是我用错了?

我正在运行 grunt v0.4.0rc2

最佳答案

更新 grunt 并将 src: ['**/?.js'] 替换为 src: ['**/*.js']

有关详细信息,请参阅 globbing patterns 上的指南.

关于gruntjs - Grunt 多任务在构建时抛出 EISDIR 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14452751/

相关文章:

css - Grunt + Sass,编译时如何包含子文件夹 scss?

node.js - Node 检查器不会分解对象属性

javascript - 运行 Node.js(在 Windows R2 服务器上): How can I reduce the amount of RAM that my grunt tasks consume?

javascript - uglify-js 支持 es6 及以上版本吗?

create-react-app - 在不弹出的情况下在Create React App中删除日志语句

node.js - 运行 Grunt 任务时的优雅 fs 警告

node.js - 如何在 grunt-rpm 插件中添加 shell 命令到 postInstall 和 preInstall

jquery - 闭包编译器/uglifyjs - this.function 名称没有缩短?

javascript - Webpack UglifyJS 仍然发出警告消息

javascript - Angularjs 缩小使用 grunt uglify 导致 js 错误