Last active
December 1, 2020 01:17
-
-
Save ernestofreyreg/8ea767de5d12cab74091edf5cda34e34 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import typescript from 'rollup-plugin-typescript2' | |
import filesize from 'rollup-plugin-filesize' | |
import nodeResolve from 'rollup-plugin-node-resolve' | |
import progress from 'rollup-plugin-progress' | |
import visualizer from 'rollup-plugin-visualizer' | |
import commonjs from 'rollup-plugin-commonjs' | |
import json from '@rollup/plugin-json' | |
import replace from 'rollup-plugin-replace' | |
import postcss from 'rollup-plugin-postcss' | |
import { terser } from 'rollup-plugin-terser' | |
import pkg from './package.json' | |
export default { | |
input: 'src/index.tsx', | |
output: [ | |
{ | |
file: `build/${pkg.name}.js`, | |
format: 'umd', | |
name: pkg.name.replace('-', '_'), | |
sourcemap: false | |
} | |
], | |
context: 'window', | |
plugins: [ | |
progress(), | |
nodeResolve({ | |
browser: true | |
}), | |
json(), | |
typescript({ | |
rollupCommonJSResolveHack: true, | |
exclude: ['src/__tests__/**', 'src/**/*.stories.*'], | |
clean: true | |
}), | |
commonjs({ | |
include: ['node_modules/**'], | |
namedExports: { | |
'node_modules/react/index.js': [ | |
'Children', | |
'Component', | |
'PropTypes', | |
'createElement', | |
'useState', | |
'useMemo' | |
], | |
'node_modules/react-dom/index.js': ['render'] | |
} | |
}), | |
postcss({ | |
plugins: [require('postcss-import'), require('tailwindcss'), require('autoprefixer')] | |
}), | |
visualizer(), | |
filesize(), | |
replace({ | |
'process.env.NODE_ENV': JSON.stringify('production') | |
}), | |
terser() | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment