mirror of
https://github.com/iconify/iconify.git
synced 2024-11-09 23:00:56 +00:00
32 lines
630 B
TypeScript
32 lines
630 B
TypeScript
|
import { BuildEntry, defineBuildConfig } from 'unbuild';
|
||
|
import packageJSON from './package.json';
|
||
|
|
||
|
const entries: BuildEntry[] = [];
|
||
|
const exportsList = packageJSON['exports'];
|
||
|
const match = './lib/';
|
||
|
|
||
|
Object.keys(exportsList).forEach((key) => {
|
||
|
if (key.slice(0, match.length) !== match) {
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
const importValue = exportsList[key]['import'];
|
||
|
if (importValue === key + '.mjs') {
|
||
|
const name = key.slice(match.length);
|
||
|
entries.push({
|
||
|
input: 'src/' + name,
|
||
|
name,
|
||
|
});
|
||
|
}
|
||
|
});
|
||
|
|
||
|
export default defineBuildConfig({
|
||
|
outDir: './lib',
|
||
|
entries,
|
||
|
clean: true,
|
||
|
declaration: true,
|
||
|
rollup: {
|
||
|
emitCJS: true,
|
||
|
},
|
||
|
});
|