import-to-require package
Select the line (or lines) with the 'import' ES6 syntax and press ctrl+alt+m to turn it into a line with 'require' ES5 syntax.
You can select multiple lines to modify several import lines at a time.
But doesn't support multi-cursors.
Convert "export" and "export default" from current file by pressing ctrl+alt+p without selecting anything. Press twice if you have export and export default in the same file.
Support those kinds of imports:
import moment from "moment";
=> const moment = require("moment");
import React from "react";
=> const React = require("react");
import text from "../../helpers/text";
=> const text = require("../../helpers/text");
import Button from "../../elements/buttons/Button";
=> const Button = require("../../elements/buttons/Button");
import { Container1 } from "next/app";
=> const Container1 = require("next/app").Container1;
import { checkmark } from "../../elements/utils";
=> const checkmark = require("../../elements/utils").checkmark;
import { IntlProvider, addLocaleData } from "react-intl";
=> const IntlProvider = require("react-intl").IntlProvider;
=> const addLocaleData = require("react-intl").addLocaleData;
import { close as crossIcon } from "react-icons-kit/ionicons/close";
=> const crossIcon = require("react-icons-kit/ionicons/close").close;
import { close as crossIcon, open as openIcon } from "react-icons-kit/ionicons/close";
=> const crossIcon = require("react-icons-kit/ionicons/close").close;
=> const openIcon = require("react-icons-kit/ionicons/close").open;
import App, { Container, connect, coon as alias } from "next/app";
=> const App = require(next/app);
=> const Container = require("next/app").Container;
=> const connect = require("next/app").connect;
=> const alias = require("next/app").coon;
import {
compose,
withApollo,
gql
} from 'react-apollo';
=> const compose = require('react-apollo').compose;
=> const withApollo = require('react-apollo').withApollo;
=> const gql = require('react-apollo').gql;
Support those kinds of exports:
export const notBinString = binString => { ... }
=> exports.notBinString = binString => { ... }
export default { ... }
=> module.exports = { ... }
export { Appointment, AppointmentTC };
=> module.exports = { Appointment, AppointmentTC };