|
1 | 1 | import path from 'path'
|
2 |
| -import vue from 'rollup-plugin-vue' |
3 |
| -import { terser } from 'rollup-plugin-terser' |
| 2 | +import typescript from 'rollup-plugin-typescript2' |
4 | 3 | import replace from 'rollup-plugin-replace'
|
5 |
| -import resolve from 'rollup-plugin-node-resolve' |
6 |
| -import common from 'rollup-plugin-commonjs' |
| 4 | +import { terser } from 'rollup-plugin-terser' |
7 | 5 |
|
| 6 | +import typescriptPluginOptions from './base/plugins/typescript' |
| 7 | +import basePlugins from './base/plugins/index' |
| 8 | + |
| 9 | +const SOURCE = path.join(__dirname, '../src/index.ts') |
| 10 | +const DIST_DIR = 'dist' |
| 11 | +const FILE_NAME = 'vue-accessible-modal' |
8 | 12 | const name = 'VueAccessibleModal'
|
| 13 | +const external = ['vue'] |
9 | 14 | const plugins = [
|
10 | 15 | replace({
|
11 | 16 | 'process.env.NODE_ENV': JSON.stringify('production'),
|
12 | 17 | }),
|
13 |
| - resolve(), |
14 |
| - common(), |
15 |
| - vue(), |
16 |
| - terser(), |
17 |
| -] |
| 18 | +].concat(basePlugins) |
18 | 19 |
|
| 20 | +/** @type {import('rollup').RollupOptions} */ |
19 | 21 | export default [
|
20 | 22 | {
|
21 |
| - input: path.join(__dirname, '..', 'src', 'index.js'), |
| 23 | + input: SOURCE, |
| 24 | + external, |
22 | 25 | output: [
|
23 | 26 | {
|
24 |
| - file: 'dist/vue-accessible-modal.js', |
| 27 | + file: `${DIST_DIR}/${FILE_NAME}.js`, |
25 | 28 | format: 'umd',
|
26 | 29 | name,
|
27 | 30 | },
|
28 | 31 | {
|
29 |
| - file: 'dist/vue-accessible-modal.common.js', |
| 32 | + file: `${DIST_DIR}/${FILE_NAME}.common.js`, |
30 | 33 | format: 'cjs',
|
31 | 34 | },
|
32 | 35 | {
|
33 |
| - file: 'dist/vue-accessible-modal.esm.js', |
| 36 | + file: `${DIST_DIR}/${FILE_NAME}.esm.js`, |
34 | 37 | format: 'esm',
|
35 | 38 | },
|
36 | 39 | ],
|
37 |
| - plugins, |
| 40 | + plugins: [ |
| 41 | + typescript(Object.assign({}, typescriptPluginOptions, { tsconfig: './tsconfig.prod.json'})), |
| 42 | + ].concat(plugins), |
38 | 43 | },
|
39 | 44 | {
|
40 |
| - input: path.join(__dirname, '..', 'src', 'index.js'), |
| 45 | + input: SOURCE, |
| 46 | + external, |
41 | 47 | output: {
|
42 |
| - file: 'dist/vue-accessible-modal.min.js', |
| 48 | + file: `${DIST_DIR}/${FILE_NAME}.min.js`, |
43 | 49 | format: 'umd',
|
44 | 50 | name,
|
45 | 51 | },
|
46 |
| - plugins, |
| 52 | + plugins: [ |
| 53 | + typescript(Object.assign({}, typescriptPluginOptions, { tsconfig: './tsconfig.prod.umd.json'})), |
| 54 | + terser() |
| 55 | + ].concat(plugins), |
47 | 56 | },
|
48 | 57 | ]
|
0 commit comments