forked from onesine/react-tailwindcss-select
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
40 lines (38 loc) · 1.11 KB
/
rollup.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import babel from '@rollup/plugin-babel';
import commonjs from '@rollup/plugin-commonjs';
import typescript from '@rollup/plugin-typescript';
import resolve from '@rollup/plugin-node-resolve';
import { terser } from "rollup-plugin-terser";
const dev = process.env.NODE_ENV === "dev"
const MODES = ['cjs', 'esm'];
export default MODES.map(item => {
const config = {
input: `src/index.tsx`,
output: {
name: "ReactTailwindcssSelect",
file: `dist/index.${item}${dev ? '' : '.min'}.js`,
format: item,
sourcemap: true,
exports: "auto",
globals: {
'react': 'React'
}
},
external: ["react"],
plugins: [
resolve(),
babel({
babelHelpers: "bundled",
exclude: ['node_modules/**']
}),
commonjs(),
typescript(),
]
};
if (!dev) {
delete config.output.sourcemap;
delete config.plugins.sourcemap
config.plugins = [...config.plugins, terser()]
}
return config;
});