0.2.1 • Published 4 years ago

import2require v0.2.1

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

Import2require

Command-line tool to convert import and export statements in JavaScript files to require and module.exports instead.

This tool is meant to be used when you need to convert a codebase from one style to the other.

Example

// This code...
import absalom from 'absalom';
import westcrown from './westcrown.js';
import { sandpoint, magnimar } from 'varisia';
import { nisroch, ridwan } from 'nidal';

export default {
  world: 'golarion',
};

// ...will be converted to
const absalom = require('absalom');
const westcrown = require('./westcrown.js');
const { sandpoint, magnimar } = require('varisia');
const { nisroch, ridwan } = require('nidal');

module.exports = {
  world: 'golarion',
};

Usage

Install import2require locally or globally, then run import2require ./path/to/files.js. Make sure you backup your files before running it, just in case.

0.2.1

4 years ago

0.2.0

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago