Skip to content
This repository has been archived by the owner on Mar 6, 2020. It is now read-only.

Commit

Permalink
Fix ie (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerturdenpants authored Apr 17, 2019
1 parent 2d04244 commit e31de0d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
30 changes: 29 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
'use strict';
const caniuse = require('caniuse-api')

module.exports = {
name: require('./package').name
name: require('./package').name,
options: {
autoImport: {
alias: {}
}
},

chooseLibPhoneForTargets(targets = {}) {
let { browsers = [] } = targets;
let browserQuery = browsers.join(',');
if (caniuse.isSupported('es6-module', browserQuery)) {
return 'libphonenumber/index.es6.js';
}
return 'libphonenumber-js/bundle/libphonenumber-js.min.js';
},

included() {
this._super.included.apply(this, arguments);

let findHost = this._findHost;
let app = findHost.call(this);

this.app = app;
let targets = this.project.targets;

this.options.autoImport.alias['libphonenumber-js'] = this.chooseLibPhoneForTargets(targets);
}

};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"test:all": "ember try:each"
},
"dependencies": {
"caniuse-api": "^3.0.0",
"ember-auto-import": "^1.2.21",
"ember-cli-babel": "^7.7.3",
"libphonenumber-js": "~1.0.24"
Expand Down

0 comments on commit e31de0d

Please sign in to comment.