rewrite-imports
Transforms various import
statements into ES5-compatible require()
calls, using regular expressions.
Caveats
Install
$ npm install --save rewrite-imports
Usage
const rewriteImports = require('rewrite-imports');
rewriteImports(`import foo from '../bar'`);
rewriteImports(`import { foo } from 'bar'`);
rewriteImports(`import * as path from 'path';`);
rewriteImports(`import { foo as bar, baz as bat, lol } from 'quz';`);
API
rewriteImports(input)
input
Type: String
An import
statement. See MDN for valid Syntax.
License
MIT © Luke Edwards