Files
lucide/rollup.config.js
Eric Fennis 11c6a2e917 Featherity Npm package, reorganize scripting. (#52)
* New setup for new NPM package

* Add build scripts for dist

* Add introduction readme

* Refactor names

* update package.json

* remove log

* rename variable

* Factoring

* Improve optimize script

* Add eslint config

* Eslint fixes

* rename import

* Move packeges

* Setup rollup and build progress

* Refactor scripts

* fix lint error

* remove lint disabler

* Bring back old libraries

* add indentation

* reset packages directory

* remove vscode setting files

* 0.1.0-alpha.0

* new version

* 0.1.0-alpha.1

* Fix build process

* Add create element to the entry file

* update version number

* publish new alhpa version

* fixing bugs

* Add jest and tests

* replace with XML createElement

* set new version

* Fix svg generation

* Add tests for main library

* Update docs

* Adjust tests and selectors

* update the spec

* Update README.md

* Update README.md

* Update README.md

* update version

* Update README.md

* Move function to helpers file

* rename license, package and readme

* Fix build files

* rename packages

Co-authored-by: Eric Fennis <eric.fennis@endurance.com>
2020-10-06 20:23:26 +02:00

78 lines
1.9 KiB
JavaScript

import babel from '@rollup/plugin-babel';
import bundleSize from '@atomico/rollup-plugin-sizes';
import compiler from '@ampproject/rollup-plugin-closure-compiler';
import { terser } from 'rollup-plugin-terser';
import visualizer from 'rollup-plugin-visualizer';
import license from 'rollup-plugin-license';
import replace from 'rollup-plugin-replace';
import resolve from 'rollup-plugin-node-resolve';
import commonJS from 'rollup-plugin-commonjs';
import pkg from './package.json';
const outputFileName = pkg.name;
const inputs = ['build/lucide.js'];
const bundles = [
{
inputs,
format: 'umd',
dir: 'dist',
minify: true,
},
{
inputs,
format: 'umd',
dir: 'dist',
},
{
inputs,
format: 'cjs',
dir: 'dist',
},
];
const configs = bundles
.map(({ inputs, dir, format, minify }) =>
inputs.map(input => ({
input,
external: ['lodash/camelCase', 'lodash/upperFirst'],
plugins: [
replace({
'icons = {}': 'icons = allIcons',
delimiters: ['', ''],
}),
babel({
babelHelpers: 'bundled',
}),
// The two minifiers together seem to procude a smaller bundle 🤷‍♂️
minify && compiler(),
minify && terser(),
license({
banner: `${pkg.name} v${pkg.version} - ${pkg.license}`,
}),
bundleSize(),
resolve(),
commonJS({
include: 'node_modules/**',
}),
visualizer({
sourcemap: true,
filename: `stats/${outputFileName}${minify ? '-min' : ''}.html`,
}),
].filter(Boolean),
output: {
name: 'lucide',
file: `${dir}/${format}/${outputFileName}${minify ? '.min' : ''}.js`,
format,
sourcemap: true,
globals: {
'lodash/camelCase': 'camelCase',
'lodash/upperFirst': 'upperFirst',
},
},
})),
)
.flat();
export default configs;