Convert imports to ES6 from CommonJS

This is needed because `require()` means something different in webpack - it ends up importing the module as something we didn't expect (and is occasionally async)
This commit is contained in:
Travis Ralston 2019-12-20 14:41:07 -07:00
parent 042bd35d79
commit f1ac3d2f64
38 changed files with 67 additions and 92 deletions

View file

@ -15,9 +15,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import Matrix from 'matrix-js-sdk';
const InteractiveAuth = Matrix.InteractiveAuth;
import {InteractiveAuth} from "matrix-js-sdk";
import React, {createRef} from 'react';
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types';

View file

@ -20,7 +20,7 @@ limitations under the License.
import React from 'react';
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types';
import Matrix from "matrix-js-sdk";
import * as Matrix from "matrix-js-sdk";
// focus-visible is a Polyfill for the :focus-visible CSS pseudo-attribute used by _AccessibleButton.scss
import 'focus-visible';

View file

@ -19,8 +19,7 @@ import React from 'react';
import createReactClass from 'create-react-class';
import { _t } from '../../languageHandler';
import {MatrixClientPeg} from "../../MatrixClientPeg";
const sdk = require('../../index');
import * as sdk from "../../index";
/*
* Component which shows the global notification list using a TimelinePanel

View file

@ -20,11 +20,9 @@ import React from 'react';
import createReactClass from 'create-react-class';
import {ContentRepo} from "matrix-js-sdk";
import {MatrixClientPeg} from "../../MatrixClientPeg";
const Modal = require('../../Modal');
const sdk = require('../../index');
const dis = require('../../dispatcher');
import * as sdk from "../../index";
import dis from "../../dispatcher";
import Modal from "../../Modal";
import { linkifyAndSanitizeHtml } from '../../HtmlUtils';
import PropTypes from 'prop-types';
import { _t } from '../../languageHandler';

View file

@ -18,22 +18,19 @@ limitations under the License.
*/
import SettingsStore from "../../settings/SettingsStore";
import React, {createRef} from 'react';
import createReactClass from 'create-react-class';
import ReactDOM from "react-dom";
import PropTypes from 'prop-types';
const Matrix = require("matrix-js-sdk");
const EventTimeline = Matrix.EventTimeline;
const sdk = require('../../index');
import {EventTimeline} from "matrix-js-sdk";
import * as Matrix from "matrix-js-sdk";
import { _t } from '../../languageHandler';
import {MatrixClientPeg} from "../../MatrixClientPeg";
const dis = require("../../dispatcher");
import * as ObjectUtils from "../../ObjectUtils";
const Modal = require("../../Modal");
const UserActivity = require("../../UserActivity");
import UserActivity from "../../UserActivity";
import Modal from "../../Modal";
import dis from "../../dispatcher";
import * as sdk from "../../index";
import { KeyCode } from '../../Keyboard';
import Timer from '../../utils/Timer';
import shouldHideEvent from '../../shouldHideEvent';

View file

@ -18,8 +18,8 @@ import React from 'react';
import createReactClass from 'create-react-class';
import PropTypes from 'prop-types';
import ContentMessages from '../../ContentMessages';
const dis = require('../../dispatcher');
const filesize = require('filesize');
import dis from "../../dispatcher";
import filesize from "filesize";
import { _t } from '../../languageHandler';
module.exports = createReactClass({