2023-01-17 08:04:34 +01:00
|
|
|
import plugins, { replace } from '@lucide/rollup-plugins';
|
2022-11-07 22:29:19 +01:00
|
|
|
import pkg from './package.json' assert { type: 'json' };
|
2022-06-12 22:31:05 +02:00
|
|
|
|
|
|
|
|
const packageName = 'LucideReact';
|
|
|
|
|
const outputFileName = 'lucide-react-native';
|
2022-08-10 09:10:53 +02:00
|
|
|
const outputDir = 'dist';
|
2022-12-04 22:38:56 +01:00
|
|
|
const inputs = ['src/lucide-react-native.ts'];
|
2022-06-12 22:31:05 +02:00
|
|
|
const bundles = [
|
|
|
|
|
{
|
|
|
|
|
format: 'cjs',
|
|
|
|
|
inputs,
|
|
|
|
|
outputDir,
|
|
|
|
|
preserveModules: true,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
format: 'esm',
|
|
|
|
|
inputs,
|
|
|
|
|
outputDir,
|
|
|
|
|
preserveModules: true,
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const configs = bundles
|
|
|
|
|
.map(({ inputs, outputDir, format, minify, preserveModules }) =>
|
|
|
|
|
inputs.map(input => ({
|
|
|
|
|
input,
|
2023-01-17 08:04:34 +01:00
|
|
|
plugins: [
|
|
|
|
|
// This for aliases, only for esm
|
|
|
|
|
...(
|
|
|
|
|
format !== 'esm' || format !== 'cjs' ? [
|
|
|
|
|
replace({
|
|
|
|
|
"export * from './aliases';": '',
|
|
|
|
|
"export * as icons from './icons';": '',
|
|
|
|
|
delimiters: ['', ''],
|
|
|
|
|
preventAssignment: false,
|
|
|
|
|
}),
|
|
|
|
|
] : []
|
|
|
|
|
),
|
|
|
|
|
...plugins(pkg, minify)
|
|
|
|
|
],
|
2022-12-04 22:38:56 +01:00
|
|
|
external: ['react', 'prop-types', 'react-native-svg'],
|
2022-06-12 22:31:05 +02:00
|
|
|
output: {
|
|
|
|
|
name: packageName,
|
|
|
|
|
...(preserveModules
|
|
|
|
|
? {
|
|
|
|
|
dir: `${outputDir}/${format}`,
|
2022-08-10 09:10:53 +02:00
|
|
|
exports: 'auto',
|
2022-06-12 22:31:05 +02:00
|
|
|
}
|
|
|
|
|
: {
|
|
|
|
|
file: `${outputDir}/${format}/${outputFileName}${minify ? '.min' : ''}.js`,
|
|
|
|
|
}),
|
|
|
|
|
format,
|
|
|
|
|
preserveModules,
|
|
|
|
|
sourcemap: true,
|
|
|
|
|
globals: {
|
|
|
|
|
react: 'react',
|
|
|
|
|
'react-native-svg': 'react-native-svg',
|
|
|
|
|
'prop-types': 'PropTypes',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
})),
|
|
|
|
|
)
|
|
|
|
|
.flat();
|
|
|
|
|
|
|
|
|
|
export default configs;
|