-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
56 lines (53 loc) · 1.33 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
/**
* @Author: Hanrea
* @Date: 2023/9/11 17:36:53
* @LastEditors: Hanrea
* @LastEditTime: 2023/9/11 17:36:53
* Description:
* Copyright: Copyright (©)}) 2023 Vecmat.com. All rights reserved.
*/
import copy from 'rollup-plugin-copy'
import { summary } from 'rollup-plugin-summary';
import typescript from '@rollup/plugin-typescript';
import { nodeResolve } from '@rollup/plugin-node-resolve';
/**
* @type {import('rollup').RollupOptions}
*/
export default {
input: ['src/index.ts'],
output: [
{
dir: 'dist',
format: "cjs",
sourcemap: true,
interop: 'auto',
exports: 'named',
preserveModules: true,
entryFileNames: 'cjs/[name].cjs'
},
{
dir: 'dist',
format: "esm",
sourcemap: true,
interop: 'auto',
exports: 'named',
preserveModules: true,
entryFileNames: 'esm/[name].mjs'
}
],
plugins: [typescript({ tsconfig: 'tsconfig.build.json' }), nodeResolve(), summary(),
copy({
targets: [
{ src: 'README.md', dest: 'dist/' },
{ src: ".npmignore", dest: 'dist/' },
{
src: 'package.json', dest: 'dist/',
// transform: (contents, filename) => {
// return contents.toString().replace('__SCRIPT__', 'app.js')
// }
},
]
})
],
external: [/node_modules/],
};