【问题标题】:Building ArcGIS with bower, node, grunt使用 bower、node、grunt 构建 ArcGIS
【发布时间】:2016-12-16 15:46:48
【问题描述】:

我正在努力在本地设置 arcgis javascript api。 尝试关注https://developers.arcgis.com/javascript/latest/guide/get-api/index.html#using-bower-for-local-builds,但没有用。示例应用程序没有帮助https://github.com/Esri/jsapi-resources.git

  • Bower 安装 arcgis-js-api
  • 我设置了一个 dojoConfig 文件
  • npm 安装
  • 凉亭安装
  • 咕噜构建 => 失败

    错误:找不到模块“src/dojo/dojo.js”

它应该如何工作,因为 bower 安装的包还没有准备好 npm。不能动态加载。威士忌探戈狐步舞。 请帮忙。

试过 yeoman 生成器 arcgis-js-app 还是不行。我得到同样的错误 /sampleapp/src/dojo/dojo.js" 错误 (404): "Not found"

【问题讨论】:

    标签: javascript dojo arcgis arcgis-js-api


    【解决方案1】:

    假设您按原样使用示例应用程序(即您还没有修改它),那么听起来您的 bower 安装失败了。在src 下,您应该会看到esridojo 之类的文件夹 - 如果它们不存在,则表示凉亭安装未完成。

    【讨论】:

    • 嗨。实际上凉亭安装很好。我可以看到文件夹“esri”“dojo”“dgrid”..etc
    • [更正] bower为什么会安装在src下? bower 将安装在 bower_components 中。 src/dojo.js 应该是代码的构建版本。
    【解决方案2】:

    您可以像这样配置 Dojo:

      var dojoConfig = {
      baseUrl: '.',
      packages: [
      {
        name: 'dgrid',
        location: 'bower_components/dgrid',
      },
      {
        name: 'dijit',
        location: 'bower_components/dijit',
      },
      {
        name: 'dojo',
        location: 'bower_components/dojo',
      },
      {
        name: 'dojox',
        location: 'bower_components/dojox',
      },
      {
        name: 'dstore',
        location: 'bower_components/dstore',
      },
      {
        name: 'esri',
        location: 'bower_components/esri',
      },
      {
        name: 'put-selector',
        location: 'bower_components/put-selector',
      },
      {
        name: 'xstyle',
        location: 'bower_components/xstyle',
      }
      ]
      };
    

    或配置凉亭(在 .bowerrc 中):

    {
    "directory":"src/"
    }
    

    来源:official documentation

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-08-23
      • 2013-11-10
      • 1970-01-01
      • 2016-05-11
      • 1970-01-01
      • 2014-10-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多