1.0.4 • Published 7 years ago
tr-require v1.0.4
tr-require
require node modules with latest ES standards.
Description
tr-require uses babeljs with the latest preset to transpile the required module if necessary.
Installation
npm install --save tr-require
Usage
Replace the require function with the tr-require module.
require = require('tr-require')
const myModule = require('my-es6-module')
Thats it.
Example
// exist.js
import fs from 'fs'
const exists = fs.existsSync
export { exists }
// index.js
require = require('tr-require')
const exists = require('./exist.js').exists
…