Ember.js项目与IE 10的兼容性

时间:2018-09-06 17:45:32

标签: javascript ember.js

我正在尝试在IE10(Ember.js 2.18)上完成我的项目。首先,我在Intl API上遇到错误...然后我发现https://github.com/alexlafroscia/ember-cli-polyfill-io并运行良好。现在我发现自己遇到了这个错误:

SCRIPT5007: Unable to get property 'polymorphic' of undefined or null reference vendor.js, line 16342 character 3

我尝试调试,发现Popper.js(或使用同一文件的ember-popper)可能存在问题。以前有人遇到过吗?关于如何更好地调试供应商捆绑包的任何提示?

Package.json:

{
  "name": "sinistro-vulcano-ui",
  "version": "0.0.0",
  "private": true,
  "description": "Small description for sinistro-vulcano-ui goes here",
  "license": "MIT",
  "author": "",
  "directories": {
    "doc": "doc",
    "test": "tests"
  },
  "repository": "",
  "scripts": {
    "build": "ember build",
    "lint:js": "eslint ./*.js app config lib server tests",
    "start": "ember serve",
    "test": "cross-env COVERAGE=true ember test",
    "prepush": "npm test"
  },
  "devDependencies": {
    "babel-plugin-transform-object-rest-spread": "~6.26.0",
    "babel-preset-es2015": "^6.24.1",
    "bootstrap-sass": "~3.3.7",
    "broccoli-asset-rev": "~2.7.0",
    "cross-env": "~5.1.4",
    "ember-ajax": "~3.1.0",
    "ember-browserify": "^1.2.2",
    "ember-cli": "~2.18.2",
    "ember-cli-app-version": "~3.1.0",
    "ember-cli-babel": "~6.12.0",
    "ember-cli-code-coverage": "~0.4.2",
    "ember-cli-dependency-checker": "~2.1.0",
    "ember-cli-eslint": "~4.2.1",
    "ember-cli-google-fonts": "~2.16.2",
    "ember-cli-htmlbars": "~2.0.1",
    "ember-cli-htmlbars-inline-precompile": "~1.0.0",
    "ember-cli-inject-live-reload": "~1.7.0",
    "ember-cli-mirage": "~0.4.3",
    "ember-cli-moment-shim": "~3.7.1",
    "ember-cli-polyfill-io": "^1.2.3",
    "ember-cli-qunit": "~4.3.2",
    "ember-cli-sass": "~7.2.0",
    "ember-cli-shims": "~1.2.0",
    "ember-cli-sri": "~2.1.0",
    "ember-cli-string-helpers": "~1.8.1",
    "ember-cli-uglify": "~2.1.0",
    "ember-cli-uuid": "~0.6.0",
    "ember-cli-yadda": "~0.2.3",
    "ember-cp-validations": "~3.5.1",
    "ember-data": "~2.18.2",
    "ember-data-copyable": "^0.4.0",
    "ember-data-model-fragments": "~2.14.0",
    "ember-export-application-global": "~2.0.0",
    "ember-inputmask": "~0.6.7",
    "ember-intl": "^3.2.4",
    "ember-load-initializers": "~1.1.0",
    "ember-moment": "~7.6.0",
    "ember-power-calendar": "~0.7.2",
    "ember-power-select": "~1.10.4",
    "ember-radio-button": "~1.2.3",
    "ember-resolver": "~4.5.5",
    "ember-root-url": "~0.2.0",
    "ember-sinon-qunit": "~3.1.0",
    "ember-source": "~2.18.0",
    "ember-truth-helpers": "~2.0.0",
    "ember-welcome-page": "~3.2.0",
    "eslint-config-airbnb-base": "~12.1.0",
    "eslint-plugin-ember": "~5.2.0",
    "eslint-plugin-import": "~2.11.0",
    "husky": "~0.14.3",
    "loader.js": "~4.7.0",
    "sinistro-navbar-addon-ui": "git+ssh://git@bitbucket.org/sciensa/sinistro-navbar-addon-ui.git#2.2.0"
  },
  "engines": {
    "node": "~4.5 || 6.* || >= 7.*"
  },
  "dependencies": {
    "boleto-brasileiro-validator": "~1.0.3",
    "cpf_cnpj": "~0.2.0"
  }
}

ember-cli-build.js:

const EmberApp = require('ember-cli/lib/broccoli/ember-app');

module.exports = function (defaults) { // eslint-disable-line
  const env = EmberApp.env();
  const isProductionLikeBuild = ['production', 'hml'].indexOf(env) > -1;
  const app = new EmberApp(defaults, {
    'ember-bootstrap': {
      bootstrapVersion: 3,
      importBootstrapFont: true,
      importBootstrapCSS: false,
    },
    'ember-cli-babel': {
      includePolyfill: true,
    },
    babel: {
      plugins: ['transform-object-rest-spread'],
    },
    'ember-cli-uglify': {
      enabled: isProductionLikeBuild,
    },
  });

  return app.toTree();
};

1 个答案:

答案 0 :(得分:0)

默认情况下,

琥珀色包含babel.js。您可以在config/targets.js

下配置要定位的浏览器
const browsers = [
  'last 1 Chrome versions',
  'last 1 Firefox versions',
  'last 1 Safari versions'
];

const isCI = !!process.env.CI;
const isProduction = process.env.EMBER_ENV === 'production';

if (isCI || isProduction) {
  browsers.push('ie 10');
}

module.exports = {
  browsers
};

参考:https://guides.emberjs.com/release/configuring-ember/build-targets/