rollup-plugin-aggregate-exports

1.0.0 • Public • Published

rollup-plugin-aggregate-exports Latest version Monthly downloads Install size

Emit an entry file to aggregate exports across multiple files.

If you like this project, please star it & follow me to see what other cool projects I'm working on! ❤️

🚀 Install

npm i -D rollup-plugin-aggregate-exports

🚦 Quick Setup

import aggregateExports from 'rollup-plugin-aggregate-exports';

const rollupConfig = {
	input: 'src/file.js',
	plugins: [
		aggregateExports({
			// file name for the entry file
			fileName: 'index.js',

			// export statements
			exports: [
				{
					identifier: 'default',
					as: 'entry',
					from: './entry.js',
				},
				{
					identifier: 'default',
					as: 'chunk',
					from: './chunk.js',
				},
			],
		}),
	],
	output: {
		format: 'esm',
		file: 'dist/entry.js',
		exports: 'default',
	},
};

export default rollupConfig;

⚙️ API

interface Export {
	/**
	 * Path to import from
	 */
	from: string;

	/**
	 * Identifier to imort
	 */
	identifier: string;

	/**
	 * Name to export as
	 */
	as?: string;
}

aggregateExports(options?: {

	/**
	 * The file name to use for the emitted entry file.
	 * 
	 * @defaultValue `index.js`
	 */
	fileName?: string;


	/**
	 * The exports you want to aggregate.
	 * 
	 * @defaultValue `[]`
	 */
	exports?: (string | Export)[];
});

Package Sidebar

Install

npm i rollup-plugin-aggregate-exports

Weekly Downloads

2

Version

1.0.0

License

MIT

Unpacked Size

4.5 kB

Total Files

4

Last publish

Collaborators

  • hirokiosame