导入ember-cli-uuid时未定义的UUID

时间:2018-04-30 12:27:47

标签: ember.js uuid ember-cli-addons

我在package.json中添加了ember-cli-uuid(0.4.1)。这是我的依赖关系的样子。

  "devDependencies": {
    "autoprefixer": "^6.5.0",
    "broccoli-asset-rev": "^2.4.5",
    "chai": "3.5.0",
    "chai-jquery": "^2.0.0",
    "ember-browserify": "1.1.13",
    "ember-can": "~0.8.1",
    "ember-cli": "2.12.3",
    "ember-cli-app-version": "^2.0.0",
    "ember-cli-babel": "^5.1.7",
    "ember-cli-chai": "0.4.3",
    "ember-cli-code-coverage": "0.3.12",
    "ember-cli-dependency-checker": "^1.3.0",
    "ember-cli-dotenv": "^1.2.0",
    "ember-cli-frost-blueprints": "^5.0.2",
    "ember-cli-htmlbars": "^1.1.1",
    "ember-cli-htmlbars-inline-precompile": "0.3.12",
    "ember-cli-inject-live-reload": "^1.4.1",
    "ember-cli-mirage": "0.2.5",
    "ember-cli-mocha": "0.14.4",
    "ember-cli-page-object": "1.6.0",
    "ember-cli-sass": "7.1.1",
    "ember-cli-shims": "^1.0.2",
    "ember-cli-uglify": "^1.2.0",
    "ember-cli-uuid": "0.4.1",
    "ember-css-modules": "~0.5.0",
    "ember-data": "2.8.1",
    "ember-data-model-fragments": "~2.3.1",
    "ember-export-application-global": "^1.0.5",
    "ember-faker": "1.1.0",
    "ember-fetch": "1.6.0",
    "ember-load-initializers": "^0.6.0",
    "ember-pollboy": "^1.0.1",
    "ember-resolver": "^2.0.3",
    "ember-sinon": "^0.7.0",
    "ember-source": "~2.12.0",
    "ember-test-utils": "^8.1.1",
    "loader.js": "^4.2.3",
    "lodash-es": "4.17.4",
    "postcss-nested": "~1.0.0",
    "postcss-scss": "0.4.1",
    "pr-bumper": "3.2.3",
    "sinon-chai": "^2.14.0"
  },

以下是我的bower.json依赖关系的样子:

  "dependencies": {
    "remodal": "1.0.7"
  },
  "devDependencies": {
    "Faker": "^3.1.0",
    "jquery-mockjax": "2.2.1"
  }

我尝试将其导入我的util文件并在我的民意调查中使用它

import {uuid} from 'ember-cli-uuid'

export function pollTask (generator, options = {}) {
...
  const id = uuid()
...
}

但我收到以下错误,uuid(window.uuid)未定义。

    TypeError: Cannot read property 'v4' of undefined
     at pollTask (planning-ui.js:12556)
     at Module.callback (planning-ui.js:11185)
     at Module.exports (vendor.js:111)
     at requireModule (vendor.js:32)
     at Class._extractDefaultExport (vendor.js:342878)
     at Class.resolveOther (vendor.js:342575)
     at Class.superWrapper [as resolveOther] (vendor.js:60513)
     at Class.resolveRoute (vendor.js:25111)
     at Class.resolve (vendor.js:24955)
     at resolve (vendor.js:22354)

我不确定我做错了什么。如果有人可以帮助我,我感激不尽。 我试图不使用ember-simple-uuid。

0 个答案:

没有答案