-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
38 lines (36 loc) · 935 Bytes
/
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
import babel from '@rollup/plugin-babel';
import { terser } from 'rollup-plugin-terser';
import typescript from '@rollup/plugin-typescript';
const config = {
input: 'src/VirtualizedListV2/index.ts', // 入口文件为 TypeScript
output: [
{
file: 'lib/bundle.cjs.js',
format: 'cjs'
},
{
file: 'lib/bundle.esm.js',
format: 'esm'
},
{
file: 'lib/bundle.umd.js',
format: 'umd',
name: 'ReactVirtualizedList'
}
],
external: ['react', 'react-dom'],
plugins: [
typescript(), // 指定 tsconfig 文件
babel({
babelHelpers: 'bundled',
exclude: 'node_modules/**',
presets: [
['@babel/preset-env', { modules: false }],
'@babel/preset-react',
'@babel/preset-typescript' // 添加对 TypeScript 的支持
],
}), // 处理 ESNext 特性和 React JSX
terser(), // 压缩代码
]
};
export default config;