forked from xiaobaili1992/zyd-design
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
71 lines (67 loc) · 1.86 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import resolve from '@rollup/plugin-node-resolve';
import babel from '@rollup/plugin-babel';
import commonjs from '@rollup/plugin-commonjs';
import terser from '@rollup/plugin-terser';
import vue from 'rollup-plugin-vue';
// import serve from 'rollup-plugin-serve';
// import livereload from 'rollup-plugin-livereload';
import pkg from './package.json' assert { type: 'json' };
const { version } = pkg;
const date = new Date();
const timeStr = `${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2, 0)}-${date
.getDate()
.toString()
.padStart(2, 0)} ${date.getHours().toString().padStart(2, 0)}:${date
.getMinutes()
.toString()
.padStart(2, 0)}:${date.getSeconds().toString().padStart(2, 0)}`;
export default {
input: 'src/index.js',
output: [
{
file: 'dist/index-es.js',
format: 'es',
banner: `/*!
* index-es.js v${version}
* building time ${timeStr}
* (c) 2022-2024 Evan You
* Copyright (c) 2021 Dee. All Rights Reserved.
*/`,
},
{
file: 'dist/index.js',
format: 'umd',
name: 'libBuild',
banner: `/*!
* index.js v${version}
* building time ${timeStr}
* (c) 2022-2024 Evan You
* Copyright (c) 2021 Dee. All Rights Reserved.
*/`,
},
],
plugins: [
vue({
compileTemplate: true,
css: true,
}),
babel({
babelHelpers: 'bundled',
exclude: 'node_modules/**',
extensions: ['.js', '.jsx', '.es6', '.es', '.mjs', '.vue'],
presets: [['@babel/preset-env', { modules: false }], '@vue/babel-preset-jsx'],
plugins: ['@babel/plugin-proposal-optional-chaining'],
}),
resolve(),
commonjs(),
terser(),
// serve({
// open: true,
// contentBase: ['dist'], // 'public' 目录包含 index.html
// host: 'localhost',
// port: 3000
// }),
// livereload('dist')
],
external: ['vue', 'element-ui', "dee-svg-icon"],
};