-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
56 lines (54 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
const path = require('path');
const resolve = require('@rollup/plugin-node-resolve');
const typescript = require('@rollup/plugin-typescript');
const commonjs = require('@rollup/plugin-commonjs');
const terser = require('@rollup/plugin-terser');
const postcss = require('rollup-plugin-postcss');
const alias = require('@rollup/plugin-alias');
const json = require('@rollup/plugin-json');
const projectRootDir = path.resolve(__dirname);
module.exports = [
{
input: './packages/index.ts',
output: [
{
dir: 'lib',
format: 'cjs',
entryFileNames: '[name].cjs.js',
sourcemap: false, // 是否输出sourcemap
},
{
dir: 'lib',
format: 'esm',
entryFileNames: '[name].esm.js',
sourcemap: false, // 是否输出sourcemap
},
{
dir: 'lib',
format: 'umd',
entryFileNames: '[name].umd.js',
name: '$LatLonEasy', // umd模块名称,相当于一个命名空间,会自动挂载到window下面
sourcemap: false,
plugins: [terser()],
},
],
plugins: [
alias({
entries: [{ find: '@', replacement: path.resolve(projectRootDir, 'packages') }],
}),
postcss({
minimize: true,
extensions: ['.css'],
extract: true,
// extract: path.resolve('dist/my-faceapi-js-lib.css'),
}),
json(),
resolve(),
commonjs(),
typescript({
tsconfig: './tsconfig.json',
compilerOptions: { incremental: false },
}),
],
},
];