0.3.3 • Published 10 months ago

unplugin-glob v0.3.3

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

unplugin-glob npm

Unit Test

Imports or exports files using glob match for ES Module.

Features

  • ⚡️ Supports Vite, Webpack, Vue CLI, Rollup, esbuild and more, powered by unplugin.
  • 🦾 Full TypeScript support.

Installation

npm i unplugin-glob
// vite.config.ts
import UnpluginGlob from 'unplugin-glob/vite'

export default defineConfig({
  plugins: [UnpluginGlob()],
})

// rollup.config.js
import UnpluginGlob from 'unplugin-glob/rollup'

export default {
  plugins: [UnpluginGlob()],
}

// esbuild.config.js
import { build } from 'esbuild'

build({
  plugins: [require('unplugin-glob/esbuild')()],
})

// webpack.config.js
module.exports = {
  /* ... */
  plugins: [require('unplugin-glob/webpack')()],
}

// vue.config.js
module.exports = {
  configureWebpack: {
    plugins: [require('unplugin-glob/webpack')()],
  },
}

Usage

// 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

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 © 2022-PRESENT 三咲智子

0.3.3

10 months ago

0.3.0

1 year ago

0.3.2

1 year ago

0.3.1

1 year ago

0.2.1

1 year ago

0.2.2

1 year ago

0.2.0

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago