This repository has been archived by the owner on Feb 26, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
69 lines (65 loc) · 1.96 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
// Install Rollup Plugins
// yarn add rollup @babel/core @babel/preset-env @rollup/plugin-commonjs @web/rollup-plugin-copy @rollup/plugin-node-resolve rollup-plugin-minify-html-literals rollup-plugin-summary rollup-plugin-typescript2 rollup-plugin-terser rollup-plugin-import-css @rollup/plugin-node-resolve @rollup/plugin-babel @babel/plugin-proposal-class-properties -D
import { copy } from '@web/rollup-plugin-copy';
import resolve from '@rollup/plugin-node-resolve';
import minifyHTML from 'rollup-plugin-minify-html-literals';
import summary from 'rollup-plugin-summary';
import typescript from 'rollup-plugin-typescript2';
import pkg from './package.json';
import { terser } from "rollup-plugin-terser";
import css from "rollup-plugin-import-css";
import node_resolve from "@rollup/plugin-node-resolve";
import { babel } from '@rollup/plugin-babel';
import commonjs from '@rollup/plugin-commonjs';
/**
* @type {import('rollup').RollupOptions}
*/
const config = {
input: './src/index.js', // our source file
output: [
{
file: pkg.main,
format: 'umd', // the preferred format
name: 'storage'
},
{
file: pkg.module,
format: 'es', // the preferred format
},
],
// external: [
// ...Object.keys(pkg.dependencies || {})
// ],
plugins: [
commonjs(),
node_resolve(),
babel({
babelHelpers: 'bundled',
plugins: ["@babel/plugin-proposal-class-properties"]
}),
css(),
// Resolve bare module specifiers to relative paths
resolve(),
// Minify HTML template literals
minifyHTML(),
// Minify JS
terser(
// {
// ecma: 2020,
// module: true,
// warnings: true,
// }
),
// Print bundle summary
summary(),
// Optional: copy any static assets to build directory
copy({
patterns: ['./src/styles/**/*'],
}),
// Support Typescript
typescript({
typescript: require('typescript'),
}),
],
}
export default config