12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- import fs from 'fs'
- import { getRollupPlugins } from '../../.build/build-icons.mjs'
- const pkg = JSON.parse(fs.readFileSync('package.json', 'utf-8'))
- const packageName = '@tabler/icons-preact';
- const outputFileName = 'tabler-icons-preact';
- const outputDir = 'dist';
- const inputs = ['./src/tabler-icons-preact.js'];
- const bundles = [
- {
- format: 'umd',
- inputs,
- outputDir,
- minify: true,
- },
- {
- format: 'umd',
- inputs,
- outputDir,
- },
- {
- format: 'cjs',
- inputs,
- outputDir,
- },
- {
- format: 'es',
- inputs,
- outputDir,
- },
- {
- format: 'esm',
- inputs,
- outputDir,
- preserveModules: true,
- },
- ];
- const configs = bundles
- .map(({ inputs, outputDir, format, minify, preserveModules }) =>
- inputs.map(input => ({
- input,
- plugins: getRollupPlugins(pkg, minify),
- external: ['preact', 'prop-types'],
- output: {
- name: packageName,
- ...(preserveModules
- ? {
- dir: `${outputDir}/${format}`,
- }
- : {
- file: `${outputDir}/${format}/${outputFileName}${minify ? '.min' : ''}.js`,
- }),
- preserveModules,
- format,
- sourcemap: true,
- globals: {
- preact: 'preact',
- 'prop-types': 'PropTypes',
- },
- },
- })),
- )
- .flat();
- export default configs;
|