Skip to content

Commit

Permalink
Minimal breaking amd import
Browse files Browse the repository at this point in the history
Where qz-tray factory is an object not a function

Loading the ember app in a browser results in the following error

    TypeError: this.callback.apply is not a function[Learn More]

    Module.prototype.exports  loader.js:106
    Module.prototype._reify   loader.js:143
    Module.prototype.reify    loader.js:130
    Module.prototype.exports  loader.js:104
    requireModule             loader.js:27
    <anonymous>               app-boot.js:3

Editing the qz-tray lib to use a factory function rather then factory
object allows the app to load.

Looking at https://github.com/amdjs/amdjs-api/blob/master/AMD.md#factory-
a function or object should be allowed.
  • Loading branch information
mrloop committed Sep 28, 2018
1 parent 230f168 commit 37d22c6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Application from '@ember/application';
import Resolver from './resolver';
import loadInitializers from 'ember-load-initializers';
import config from './config/environment';
import qz from 'qz-tray';

const App = Application.extend({
modulePrefix: config.modulePrefix,
Expand Down
4 changes: 4 additions & 0 deletions ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,9 @@ module.exports = function(defaults) {
// please specify an object with the list of modules as keys
// along with the exports of each module as its value.

app.import('node_modules/qz-tray/qz-tray.js', {
using: [{ transformation: 'amd', as: 'qz-tray' }],
});

return app.toTree();
};
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
"ember-welcome-page": "^3.2.0",
"eslint-plugin-ember": "^5.2.0",
"loader.js": "^4.7.0",
"qunit-dom": "^0.7.1"
"qunit-dom": "^0.7.1",
"qz-tray": "^2.0.7"
},
"engines": {
"node": "6.* || 8.* || >= 10.*"
Expand Down

0 comments on commit 37d22c6

Please sign in to comment.