lundi 30 avril 2018

undefined UUID when import ember-cli-uuid

I have added ember-cli-uuid (0.4.1)in my package.json. here is a how my dependencies look like.

  "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"
  },

and here is how my bower.json dependencies looks like:

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

i tried to import it into my util file and use it in my polling

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

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

But i get the following error and uuid (window.uuid) is undefined.

    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)

I am not sure what i am doing wrong. I appreciate if someone can help me. I am trying not to use ember-simple-uuid.




Aucun commentaire:

Enregistrer un commentaire