rollup-plugin-inject
Scan modules for global variables and inject import
statements where necessary
Archived (Migration to Mono-Repo In-Process)
This repository has been archived and is in the process of being migrated to a new monorepo. Please bear with us as we make this transition. More information to follow.
Installation
npm install --save-dev rollup-plugin-inject
Usage
import { rollup } from 'rollup';
import inject from 'rollup-plugin-inject';
rollup({
entry: 'main.js',
plugins: [
inject({
include: '**/*.js',
exclude: 'node_modules/**',
$: 'jquery',
Promise: [ 'es6-promise', 'Promise' ],
fs: [ 'fs', '*' ],
'Object.assign': path.resolve( 'src/helpers/object-assign.js' ),
modules: {
$: 'jquery',
Promise: [ 'es6-promise', 'Promise' ],
'Object.assign': path.resolve( 'src/helpers/object-assign.js' )
}
})
]
}).then(...)