Recently I try to use ember fastboot to my project and it turns out my npm package cannot be used again because of certain error. I already follow the user guide to whitelist the package but still not working.
In this case I want to call pixi.js to my ember project using from the method at user guide.
/home/route.js
import Ember from 'ember';
let PIXI = FastBoot.require('pixi.js');
export default Ember.Route.extend({
fastboot: Ember.inject.service(),
setupController: function(controller){
controller.set('message', 'This is Ember Progressive Web Application!');
console.log(PIXI);
}
});
package.json
"devDependencies": {
...
"pixi.js": "^4.2.2"
},
"fastbootDependencies": [
"pixi.js"
]
environment.js
var ENV = {
...
fastboot: {
hostWhitelist: [/^localhost:\d+$/]
}
};
I try to open localhost:3000/home
and then there's error like this
2016-11-18T10:50:22.884Z 500 Unknown Error: Error: Assertion Failed: Expected route:home to resolve to an Ember.Route but instead it was [object Object].
at new Error (native)
at Error.EmberError (/home/dio/workspace/game-app/dist/fastboot/vendor.js:29616:21)
at assert (/home/dio/workspace/game-app/dist/fastboot/vendor.js:17311:13)
at Object.assert (/home/dio/workspace/game-app/dist/fastboot/vendor.js:29428:34)
at Object.validateType [as default] (/home/dio/workspace/game-app/dist/fastboot/vendor.js:16948:24)
at null.exports.default._emberRuntimeSystemObject.default.extend.resolve (/home/dio/workspace/game-app/dist/fastboot/vendor.js:16654:51)
at resolve (/home/dio/workspace/game-app/dist/fastboot/vendor.js:12979:36)
at Object.Registry.resolve (/home/dio/workspace/game-app/dist/fastboot/vendor.js:12438:21)
at Object.Registry.resolve (/home/dio/workspace/game-app/dist/fastboot/vendor.js:12442:55)
at factoryFor (/home/dio/workspace/game-app/dist/fastboot/vendor.js:11940:28)
at instantiate (/home/dio/workspace/game-app/dist/fastboot/vendor.js:12005:19)
at lookup (/home/dio/workspace/game-app/dist/fastboot/vendor.js:11873:17)
at Object.Container.lookup (/home/dio/workspace/game-app/dist/fastboot/vendor.js:11792:14)
at null.exports.default._emberMetalMixin.Mixin.create.lookup (/home/dio/workspace/game-app/dist/fastboot/vendor.js:44856:33)
at Object.getHandler (/home/dio/workspace/game-app/dist/fastboot/vendor.js:40395:34)
at Object.HandlerInfo.fetchHandler (/home/dio/workspace/game-app/dist/fastboot/vendor.js:59076:26)
at Object.defineProperty.get (/home/dio/workspace/game-app/dist/fastboot/vendor.js:59241:19)
at Object.exports.default._routerUtils.subclass.applyToState (/home/dio/workspace/game-app/dist/fastboot/vendor.js:60480:37)
at Object.getTransitionByIntent (/home/dio/workspace/game-app/dist/fastboot/vendor.js:59445:27)
at Object.Router.transitionByIntent (/home/dio/workspace/game-app/dist/fastboot/vendor.js:59559:38)
at doTransition (/home/dio/workspace/game-app/dist/fastboot/vendor.js:60136:19)
at Object.Router.handleURL (/home/dio/workspace/game-app/dist/fastboot/vendor.js:59602:14)
at null._emberRuntimeSystemObject.default.extend._doURLTransition (/home/dio/workspace/game-app/dist/fastboot/vendor.js:40141:51)
at null._emberRuntimeSystemObject.default.extend.handleURL (/home/dio/workspace/game-app/dist/fastboot/vendor.js:40137:19)
at null._emberApplicationSystemEngineInstance.default.extend.visit (/home/dio/workspace/game-app/dist/fastboot/vendor.js:14561:21)
at /home/dio/workspace/game-app/node_modules/ember-cli-fastboot/node_modules/fastboot-express-middleware/node_modules/fastboot/dist/cjs/ember-app.js:238:28
at tryCatch (/home/dio/workspace/game-app/dist/fastboot/vendor.js:61487:14)
at invokeCallback (/home/dio/workspace/game-app/dist/fastboot/vendor.js:61502:15)
at publish (/home/dio/workspace/game-app/dist/fastboot/vendor.js:61470:9)
at /home/dio/workspace/game-app/dist/fastboot/vendor.js:50950:16
at Queue.invokeWithOnError (/home/dio/workspace/game-app/dist/fastboot/vendor.js:11532:18)
at Object.Queue.flush (/home/dio/workspace/game-app/dist/fastboot/vendor.js:11587:11)
at Object.DeferredActionQueues.flush (/home/dio/workspace/game-app/dist/fastboot/vendor.js:11395:17)
at Object.Backburner.end (/home/dio/workspace/game-app/dist/fastboot/vendor.js:10709:25)
at null._onTimeout (/home/dio/workspace/game-app/dist/fastboot/vendor.js:11275:18)
at Timer.listOnTimeout (timers.js:92:15)
Aucun commentaire:
Enregistrer un commentaire