https://github.com/s3xysteak/unplugin-index-extension
Auto import './package/index.vue' by './package', just like './package/index.js'
https://github.com/s3xysteak/unplugin-index-extension
Last synced: 4 months ago
JSON representation
Auto import './package/index.vue' by './package', just like './package/index.js'
- Host: GitHub
- URL: https://github.com/s3xysteak/unplugin-index-extension
- Owner: s3xysteak
- License: mit
- Created: 2024-04-08T08:30:48.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-04-08T08:49:02.000Z (over 1 year ago)
- Last Synced: 2025-08-06T11:29:11.392Z (5 months ago)
- Language: TypeScript
- Homepage:
- Size: 73.2 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README-zh.md
- License: LICENSE
Awesome Lists containing this project
README
# :tada: unplugin-index-extension
[English](./README.md) | 简体中文
你是否曾困扰于:
```diff
+ import JsChild from './Component'
+ import JsChildNoExt from './Component/index'
+ import JSChildDirectly from './Component/index.js'
- import VueChild from './Component'
- import SvelteChild from './Component/index'
```
这个插件赐予更多后缀名这样的能力!
## :memo: 安装
以pnpm为例:
```sh
$ pnpm i -D unplugin-index-extension
```
以Vite为例:
```js
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import IndexExt from 'unplugin-index-extension/vite'
export default defineConfig({
plugins: [
vue(),
IndexExt(),
],
})
```
同样支持 `esbuild, rollup, webpack`, 通过相同方法安装。
> 插件首先检查`.vue`,其次检查`.svelte`,之后进行默认行为。
## License
[MIT](./LICENSE) :heart: