Combines multiple module files into a single target file. It supports four modes: named exports, default exports, automatic exports, and no exports, and can auto-generate corresponding import statements based on configuration.
import { defineConfig } from 'vite';
import combine from 'vite-plugin-combine';
export default defineConfig({
plugins: [
combine({
src: 'src/*.ts', // 匹配要组合的文件路径
target: 'src/index.ts', // 目标文件路径
exports: 'named', // 导出类型:'named' | 'default' | 'both' | 'none'
})
],
build: {
minify: false,
lib: {
formats: ['es', 'cjs'],
fileName: '[name]'
}
}
});
For detailed usage instructions and API references, please visit the official documentation:
We welcome contributions from the community! If you find a bug or want to suggest an improvement, feel free to open an issue or submit a pull request.
- Fork the repository.
- Create a new branch for your changes.
- Submit a pull request with a clear description of your changes.
This project is licensed under the MIT License.