gulp-rewrite-imports
v1.1.0
Published
![NPM](https://img.shields.io/npm/v/gulp-rewrite-imports?color=green)
Downloads
25
Readme
gulp-rewrite-imports
A gulp plugin which allows to rewrite import
and require
statements in JavaScript and TypeScript files.
Install
The plugin can be installed as follows:
Yarn:
yarn add --dev gulp-rewrite-imports
NPM:
npm install --save-dev gulp-rewrite-imports
Basic usage
const { src, dest } = require('gulp');
const rewriteImports = require('gulp-rewrite-imports');
src('./src/**/*.js')
.pipe(rewriteImports({
mappings: {
'some-module-name': 'another-module-name',
'foo', {
path: './some/nested/file/bar.js',
relativeTo: './dist',
},
},
})
.pipe(dest('./dist'));