-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrollup.config.mjs
41 lines (38 loc) · 1.1 KB
/
rollup.config.mjs
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
import {nodeResolve} from "@rollup/plugin-node-resolve";
import typescript from "@rollup/plugin-typescript";
import {babel} from "@rollup/plugin-babel";
import packageJson from './package.json' assert { type: "json" };
const version = process.env.VERSION || packageJson.version
const banner = `/*!
* ${packageJson.name} v${version}
* Released under the ${packageJson.license} License.
*/`
export default {
input: 'src/pollcast.ts',
plugins: [
nodeResolve(),
// convert typescript to ecmascript
typescript(),
// transpile es6 to es5
babel({
babelHelpers: 'bundled',
extensions: ['.js', '.jsx', '.es6', '.es', '.mjs', '.ts', '.tsx']
})
],
output: [
{
file: "dist/pollcast.js",
format: "umd",
name: 'Pollcast',
banner
},
{
file: "dist/pollcast.min.js",
format: "umd",
name: 'Pollcast',
banner,
sourcemap: true,
plugins: [(await import('@rollup/plugin-terser')).default()],
}
],
};