feat: bundling for UI Components (#42549)

Co-authored-by: Huyen Nguyen <25715018+huyenltnguyen@users.noreply.github.com>
This commit is contained in:
Oliver Eyton-Williams
2021-06-21 10:21:40 +02:00
committed by GitHub
parent d8f8665170
commit 95dc63678c
6 changed files with 4789 additions and 324 deletions

View File

@ -0,0 +1,37 @@
import { nodeResolve } from '@rollup/plugin-node-resolve';
import babel from '@rollup/plugin-babel';
import postcss from 'rollup-plugin-postcss';
import commonjs from '@rollup/plugin-commonjs';
import { terser } from 'rollup-plugin-terser';
const production = process.env.NODE_ENV !== 'development';
const config = {
input: 'src/index.js',
output: [
{
file: 'dist/bundle.js',
format: 'cjs'
},
{
file: 'dist/bundle.esm.js',
format: 'es'
},
{
file: 'dist/bundle.iife.js',
format: 'iife',
globals: { react: 'React' },
name: 'uiComponents'
}
],
plugins: [
nodeResolve(),
postcss(),
babel({ babelHelpers: 'bundled' }),
commonjs(),
production && terser()
],
external: ['react']
};
export default config;