Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sxzz/unplugin-glob
Imports or exports files using glob match for ES Module.
https://github.com/sxzz/unplugin-glob
Last synced: 6 days ago
JSON representation
Imports or exports files using glob match for ES Module.
- Host: GitHub
- URL: https://github.com/sxzz/unplugin-glob
- Owner: sxzz
- License: mit
- Created: 2022-07-31T06:31:37.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-12-16T06:35:54.000Z (9 days ago)
- Last Synced: 2024-12-16T07:35:30.105Z (8 days ago)
- Language: TypeScript
- Homepage:
- Size: 495 KB
- Stars: 32
- Watchers: 1
- Forks: 5
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# unplugin-glob [![npm](https://img.shields.io/npm/v/unplugin-glob.svg)](https://npmjs.com/package/unplugin-glob)
[![Unit Test](https://github.com/sxzz/unplugin-glob/actions/workflows/unit-test.yml/badge.svg)](https://github.com/sxzz/unplugin-glob/actions/workflows/unit-test.yml)
Imports or exports files using glob match for ES Module.
# Features
- β‘οΈ Supports Vite, Webpack, Vue CLI, Rollup, esbuild and more, powered by [unplugin](https://github.com/unjs/unplugin).
- π¦Ύ Full TypeScript support.## Installation
```bash
npm i unplugin-glob
```Vite
```ts
// vite.config.ts
import UnpluginGlob from 'unplugin-glob/vite'export default defineConfig({
plugins: [UnpluginGlob()],
})
```
Rollup
```ts
// rollup.config.js
import UnpluginGlob from 'unplugin-glob/rollup'export default {
plugins: [UnpluginGlob()],
}
```
esbuild
```ts
// esbuild.config.js
import { build } from 'esbuild'build({
plugins: [require('unplugin-glob/esbuild')()],
})
```
Webpack
```ts
// webpack.config.js
module.exports = {
/* ... */
plugins: [require('unplugin-glob/webpack')()],
}
```
Vue CLI
```ts
// vue.config.js
module.exports = {
configureWebpack: {
plugins: [require('unplugin-glob/webpack')()],
},
}
```
## Usage
```ts
// To avoid type declaration conflicts, a name is needed for each directory.
import * as all from 'glob:name:./some-path/*.js'console.log(all.sth)
export * from 'glob:name:./some-path/**'
```## Configuration
```ts
Glob({
// targets to resolve
include: [/\.m?[jt]sx?$/],
exclude: options.exclude || [/\.d\.ts$/],root: process.cwd(),
// Filepath to generate corresponding .d.ts files.
// Defaults to both './glob.d.ts' and 'glob-global.d.ts' when provided `true`.
// Set `false` to disable.
dts: false, // boolean or string
})
```## Sponsors
## License
[MIT](./LICENSE) License Β© 2022-PRESENT [δΈε²ζΊε](https://github.com/sxzz)