1 | /* eslint-disable */
|
2 |
|
3 | // npm i -D rollup rollup-plugin-typescript2 typescript
|
4 | import typescript from 'rollup-plugin-typescript2'
|
5 |
|
6 | // ------------------------------------------------------------------------------------------
|
7 | // formats
|
8 | // ------------------------------------------------------------------------------------------
|
9 | // amd – Asynchronous Module Definition, used with module loaders like RequireJS
|
10 | // cjs – CommonJS, suitable for Node and Browserify/Webpack
|
11 | // esm – Keep the bundle as an ES module file
|
12 | // iife – A self-executing function, suitable for inclusion as a <script> tag. (If you want to create a bundle for your application, you probably want to use this, because it leads to smaller file sizes.)
|
13 | // umd – Universal Module Definition, works as amd, cjs and iife all in one
|
14 | // system – Native format of the SystemJS loader
|
15 |
|
16 | // ------------------------------------------------------------------------------------------
|
17 | // setup
|
18 | // ------------------------------------------------------------------------------------------
|
19 | const pkg = require('./package.json')
|
20 | const name = pkg.name
|
21 | const className = name.replace(/(^\w|-\w)/g, (c) => c.replace('-', '').toUpperCase())
|
22 |
|
23 | export default [
|
24 | {
|
25 | input: 'src/index.ts',
|
26 | output: [
|
27 | {
|
28 | file: 'dist/index.js',
|
29 | format: 'esm',
|
30 | sourcemap: false,
|
31 | name: className,
|
32 | exports: 'named',
|
33 | },
|
34 | ],
|
35 | plugins: [
|
36 | typescript({ useTsconfigDeclarationDir: true, tsconfigOverride: { exclude: ['test/**/*'] } }),
|
37 | ],
|
38 | external: Object.keys(pkg.dependencies || []),
|
39 | },
|
40 | ]
|