forked from clarkmcc/ngraph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
65 lines (64 loc) · 1.8 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import resolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import external from 'rollup-plugin-peer-deps-external'
import babel from '@rollup/plugin-babel'
import dts from 'rollup-plugin-dts'
import typescript from '@rollup/plugin-typescript'
import { glob } from 'glob'
import { fileURLToPath, URL } from 'url'
import { extname, relative } from 'path'
import { visualizer } from 'rollup-plugin-visualizer'
import postcss from 'rollup-plugin-postcss'
import css from 'rollup-plugin-css-only'
import tailwindcss from 'tailwindcss'
import autoprefixer from 'autoprefixer'
export default [
{
input: Object.fromEntries(
glob
.sync('lib/**/!(*.stories).{ts,tsx}')
.map((file) => [
relative('lib', file.slice(0, file.length - extname(file).length)),
fileURLToPath(new URL(file, import.meta.url)),
]),
),
output: [
{
format: 'es',
entryFileNames: '[name].js',
assetFileNames: 'assets/[name][extname]',
dir: 'dist/es',
// sourcemap: true,
},
{
format: 'cjs',
entryFileNames: '[name].js',
assetFileNames: 'assets/[name][extname]',
dir: 'dist/cjs',
// sourcemap: true,
},
],
plugins: [
external(),
resolve({
browser: true,
}),
postcss({
plugins: [autoprefixer(), tailwindcss()],
}),
commonjs(),
babel({
exclude: 'node_modules/**',
}),
typescript({ tsconfig: './tsconfig.json' }),
visualizer(),
],
external: ['react', 'react-dom', '@xyflow/react'],
},
// Separate configuration for generating type definitions
{
input: 'lib/index.ts',
output: [{ file: 'dist/types/index.d.ts', format: 'es' }],
plugins: [dts(), css()],
},
]