RSocket не работает в ie11 (в других браузерах все в порядке). В консоли SCRIPT1002 синтаксическая ошибка. Ссылка следует на RSocketFrame.js в
const FRAME_TYPE_NAMES = (exports.FRAME_TYPE_NAMES = {});
(0, _forEachObject2.default)(FRAME_TYPES, (value, name) => {
FRAME_TYPE_NAMES[value] = name;
});
. Я пытался добавить «response-app-polyfill» (в другом проекте работает отлично), «core-js» и «@ babel / polyfil», ни один изэто решение не работает.
index.js
import 'react-app-polyfill/ie11';
import 'react-app-polyfill/stable';
import * as React from 'react';
import ReactDOM from 'react-dom';
import ValidationLabel from './component/ValidationLabel';
const main = () => {
const element = <ValidationLabel />;
ReactDOM.render(element, document.getElementById('mainComponent'));
};
if (module.hot) {
module.hot.accept(main);
}
main();
ValidationLabel.jsx
import React, {useEffect} from 'react';
import {FormLabel} from '@material-ui/core';
import subscribeOnValidateStatusStream from '../subscription/RsocketStreamSubscriptions';
import useGlobalState from '../util/useGlobalState';
import getLocalizedStatus from '../constants/StatusConstants'
import getColorByStatus from '../constants/ColorConstants'
const urlParams = new URLSearchParams(window.location.search);
const id = urlParams.get('id');
const ValidationLabel = () => {
const { currentValidationState, setCurrentValidationState } = useGlobalState();
const sendMessage = (message) =>{
if (window.opener != window && window.opener != null) {
window.opener.postMessage(message, '*');
}else {
window.parent.postMessage(message, '*');
}
};
useEffect(() => {
subscribeOnValidateStatusStream(parseInt(id, 10), (newValidateResponse) => {
setCurrentValidationState({ ...currentValidationState, status: newValidateResponse });
sendMessage(newValidateResponse);
});
}, []);
return (
<FormLabel style={{color: getColorByStatus(currentValidationState.status)}}>
{ getLocalizedStatus(currentValidationState.status) }
</FormLabel>
);
};
export default ValidationLabel;
package.json
{
"extends": "airbnb",
"name": "ordering-package-validation",
"version": "1.0.0",
"description": "ordering-package-validation Web UI",
"repository": {
"url": "http://localhost.npm"
},
"license": "MIT",
"dependencies": {
"@material-ui/core": "^4.0.0-rc.0",
"axios": "^0.18.0",
"babel-cli": "^6.26.0",
"babel-loader": "^8.0.2",
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"core-js": "^3.3.5",
"http-status-codes": "^1.3.0",
"npm": "^6.9.0",
"parcel-bundler": "^1.11.0",
"prop-types": "^15.7.2",
"react": "^16.8.6",
"react-app-polyfill": "^1.0.1",
"react-cookie": "^3.0.8",
"react-dom": "^16.8.6",
"react-json-view": "^1.19.1",
"react-router": "^4.3.1",
"react-router-dom": "^4.3.1",
"rsocket-core": "0.0.10",
"rsocket-websocket-client": "0.0.10"
},
"scripts": {
"production": "parcel build index.html --public-url /orderingPackageValidation",
"development": "parcel index.html --public-url /"
},
"devDependencies": {
"@babel/core": "^7.2.2",
"@babel/plugin-proposal-class-properties": "^7.3.0",
"@babel/plugin-proposal-optional-chaining": "^7.2.0",
"@babel/preset-react": "^7.0.0",
"babel-eslint": "^10.0.2",
"babel-plugin-emotion": "^10.0.6",
"eslint": "^6.0.1",
"eslint-config-airbnb": "^17.1.0",
"eslint-plugin-import": "^2.18.0",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.14.2",
"eslint-plugin-react-hooks": "^1.6.1"
}
}
консоль браузера RSocketFrame.js