Grunt - Wiredep 警告:"Must provide pattern"

Grunt - Wiredep Warning: "Must provide pattern"

我正在尝试开始使用 g运行t 和 bower 来构建我的项目。所以现在我只想使用 g运行t 插件 wiredep.

将我所有安装的 bower 包注入到我的 index.html 文件中

当我尝试 运行 g运行t 命令时,它总是说:

Running "wiredep:target" (wiredep) task Warning: must provide pattern Use --force to continue.

Aborted due to warnings. Done.

我发现其他主题也有同样的错误,但 none 的解决方案似乎对我有用。

这是我的 grunfile:

module.exports = function (grunt) {

    // Project configuration.
    grunt.initConfig({
        wiredep: {

            target: {
                src: '/public_html/index.html'
            }
        }
    });

    grunt.loadNpmTasks('grunt-wiredep');

};

这是我的 bower.json:

{
  "name": "GeoSystem",
  "version": "1.0.0",
  "main": "/public_html/js/model.js",
  "ignore": [
    ".jshintrc",
    "**/*.txt"
  ],
  "dependencies": {"jQuery":"3.2.0",
    "arcgis-js-api": "4.3.0",
    "OpenLayers": "4.0.1",
    "bootstrap": "3.3.7"
  },
  "devDependencies": {}
}

这是我的 index.html:

<!DOCTYPE html>
<head>
    <!-- bower:css -->
    <!-- endbower -->
</head>
<body>
    <div class="container">
        <div id="map"></div>
    </div>

    <!-- bower:js -->
    <!-- endbower -->
</body>

谁能告诉我怎么了?

问题出在 arcgis-js-api。它的 bower.json 不提供 main 字段,这会导致 grunt-wiredep.

出现问题

https://github.com/taptapship/wiredep

如果要链接,您需要将其从 grunt-wiredep 目标中排除或覆盖并提供适当的 main。