unimport
Unified utils for auto importing APIs in modules
Install
npm install unimport
yarn install unimport
pnpm install unimport
Usage
Plugin Usage
Powered by unplugin, unimport
provides a plugin interface for bundlers.
Vite / Rollup
import Unimport from 'unimport/unplugin'
export default {
plugins: [
Unimport.vite({ })
]
}
Webpack
import Unimport from 'unimport/unplugin'
module.exports = {
plugins: [
Unimport.webpack({ })
]
}
Programmatic Usage
import { createUnimport } from 'unimport'
const { createUnimport } = require('unimport')
const { addImports } = createUnimport({
imports: [{ name: 'fooBar', from: 'test-id' }]
})
console.log(addImports('console.log(fooBar())'))
💻 Development
- Clone this repository
- Enable Corepack using
corepack enable
(use npm i -g corepack
for Node.js < 16.10) - Install dependencies using
yarn install
- Run interactive tests using
yarn dev
License
Made with 💛
Published under MIT License.