-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
51 lines (48 loc) · 1.24 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
import { defineConfig } from 'rollup'
import babel from '@rollup/plugin-babel'
import typescript from '@rollup/plugin-typescript'
import { nodeResolve } from '@rollup/plugin-node-resolve'
import postcss from 'rollup-plugin-postcss'
import terser from '@rollup/plugin-terser'
import fs from 'fs'
fs.rmSync('dist', { force: true, recursive: true })
export default defineConfig({
input: 'src/lib/index.tsx',
output: [
{
file: 'dist/jinie.js',
format: 'umd',
name: 'Jinie',
globals: {
react: 'React',
cropperjs: 'Cropper',
'compression-loop': 'CompressionLoop'
}
},
{
file: 'dist/jinie.common.js',
format: 'cjs'
},
{
file: 'dist/jinie.esm.js',
format: 'es'
}
],
external: ['react', 'react-dom', 'cropperjs', 'compression-loop'],
plugins: [
nodeResolve(),
typescript({ tsconfig: './rollup.tsconfig.json' }),
postcss({
// extract: true,
modules: true,
use: ['sass']
}),
babel({
plugins: ['@babel/plugin-transform-runtime'],
presets: ['@babel/env', '@babel/react'],
exclude: ['node_modules/**'],
babelHelpers: 'runtime'
}),
terser()
]
})