简体   繁体   中英

IE11 Script1003 expected :

I am trying to add support for IE11. I get the errors:

SCRIPT1003: Expected ':'

File: vendor.bundle.js, Line: 8699, Column: 8

SCRIPT5009: 'webpackJsonp' is undefined

File: app.bundle.js, Line: 1, Column: 1

Line 8699 throws at this:

style(props, propName, componentName) {
  if (props[propName] == null) {
    return undefined;
}

It seems as though babel isn't transpiling this Object Initializer to style: (props, propName, componentName) .

package.json:

"babel-core": "^6.26.0",
"babel-eslint": "^8.2.2",
"babel-loader": "^7.0.0",
"babel-plugin-istanbul": "^4.1.4",
"babel-plugin-relay": "^1.4.1",
"babel-preset-env": "^1.6.1",
"babel-preset-react": "^6.16.0",
"babel-preset-stage-2": "^6.22.0",
"babel-register": "^6.18.0",

.babelrc

{
  "presets": [
    "env",
    "stage-2",
    "react"
  ],
  "plugins": [
    "relay"
  ],
}

webpack.js:

{
  test: /\.jsx?$/,
  include: [
    path.resolve(__dirname, 'wwwroot/components'),
  ],
  loader: 'babel-loader',
},

I presume the second error is being caused by the first.

Edit:

Full error code:

var _StyleValidator = __webpack_require__(1396);

var _StyleValidator2 = _interopRequireDefault(_StyleValidator);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var styleValidator = exports.styleValidator = new _StyleValidator2.default();

function configStyleValidator(config) {
  styleValidator.setConfig(config);
}

exports.default = {
  style(props, propName, componentName) {
    if (props[propName] == null) {
      return undefined;
    }

    for (var _len = arguments.length, rest = Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
      rest[_key - 3] = arguments[_key];
    }

    var objErr = _propTypes2.default.object.apply(_propTypes2.default, [props, propName, componentName].concat(rest));
    if (objErr) {
      return objErr;
    }
    return styleValidator.validate(props[propName], componentName);
  }
};

原来这是一个针对节点而不是浏览器的软件包导入,在我的情况下,它是react-html-email: https : //github.com/chromakode/react-html-email/issues/51

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM