Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/simon-he95/unplugin-export-type


https://github.com/simon-he95/unplugin-export-type

Last synced: 10 days ago
JSON representation

Awesome Lists containing this project

README

        

# unplugin-export-type
为了支持在vue3中setup语法不支持动态导入类型而写的plugin

## Resolve
想要复用类型会动态导入再传入,会发生这样的错误
![example](/assets/example.png)

## Install
![install](/assets/install.png)

## 🌈 Usage

Vite

```ts
// vite.config.ts
import { vitePluginPlugin } from 'unplugin-export-type'
export default defineConfig({
plugins: [vitePluginPlugin(/* options */)],
})
```


Rollup

```ts
// rollup.config.js
import { resolve } from 'path'
import { rollupPlugin } from 'unplugin-export-type'
export default {
plugins: [rollupPlugin(/* options */)],
}
```


Webpack

```ts
// webpack.config.js
module.exports = {
/* ... */
plugins: [
require('unplugin-export-type').webpackPlugin({
/* options */
}),
],
}
```


Vue CLI

```ts
// vue.config.js
module.exports = {
configureWebpack: {
plugins: [
require('unplugin-export-type').webpackPlugin({
/* options */
}),
],
},
}
```


Esbuild

```ts
// esbuild.config.js
import { build } from 'esbuild'
import { esbuildPlugin } from 'unplugin-export-type'

build({
plugins: [esbuildPlugin(/* options */)],
})
```

[Example](./playground/src/components/Footer.vue)

## License
[MIT](./LICENSE) License © 2022 [Simon He](https://github.com/Simon-He95)

Buy Me A Coffee

![sponsors](https://www.hejian.club/images/sponsors.jpg)