-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
46 lines (45 loc) · 1.35 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
import typescript from 'rollup-plugin-typescript2'
import pkg from './package.json'
import { terser } from 'rollup-plugin-terser'
import scss from 'rollup-plugin-scss';
export default {
input: 'src/index.ts', // 入口文件
output: [
{
file: pkg.main, // 输出文件名称
format: 'cjs', // 输出模块格式
sourcemap: false, // 是否输出sourcemap
},
{
file: pkg.module,
format: 'esm',
sourcemap: false,
},
{
file: pkg.umd,
format: 'umd',
name: pkg.umdName, // umd模块名称,相当于一个命名空间,会自动挂载到window下面
sourcemap: false,
globals:{
'react':'React',
'intersection-observer-polyfill':'IntersectionObserverPolyfill'
},
plugins: [terser()],
},
],
external:['react','intersection-observer-polyfill'],
plugins: [
typescript({
tsconfigOverride: {
compilerOptions: {
module: 'ESNext',
},
},
useTsconfigDeclarationDir: true, // 使用tsconfig中的声明文件目录配置
}),
scss({
output: 'dist/index.css',
sass: require('sass')
})
],
}