|
1 | | -import path from 'path' |
2 | | -import vue from 'rollup-plugin-vue' |
3 | | -import { terser } from 'rollup-plugin-terser' |
4 | | -import typescript from 'rollup-plugin-typescript2' |
5 | | -import { version as packageVersion } from '../package.json' |
| 1 | +import path from "path"; |
| 2 | +import vue from "rollup-plugin-vue"; |
| 3 | +import { terser } from "rollup-plugin-terser"; |
| 4 | +import typescript from "rollup-plugin-typescript2"; |
| 5 | +import { version as packageVersion } from "../package.json"; |
6 | 6 |
|
7 | | -const resolve = _path => path.resolve(__dirname, '../', _path) |
8 | | -const version = process.env.VERSION || packageVersion |
| 7 | +const resolve = _path => path.resolve(__dirname, "../", _path); |
| 8 | +const version = process.env.VERSION || packageVersion; |
9 | 9 | const banner = `/*! |
10 | 10 | * @modus/ionic-vue v${version} |
11 | 11 | * ${new Date().getFullYear()} Michael Tintiuc - Modus Create |
12 | 12 | * @license MIT |
13 | 13 | */ |
14 | | -` |
| 14 | +`; |
15 | 15 |
|
16 | 16 | function outputConfig(suffix, format, opts = {}) { |
17 | 17 | return Object.assign( |
18 | 18 | { |
19 | 19 | file: resolve(`./dist/ionic-vue${suffix}.js`), |
20 | | - name: 'IonicVue', |
21 | | - exports: 'named', |
| 20 | + name: "IonicVue", |
| 21 | + exports: "named", |
22 | 22 | sourcemap: true, |
23 | 23 | format, |
24 | | - banner, |
| 24 | + banner |
25 | 25 | }, |
26 | 26 | opts |
27 | | - ) |
| 27 | + ); |
28 | 28 | } |
29 | 29 |
|
30 | 30 | function baseConfig() { |
31 | 31 | return { |
32 | | - input: resolve('./src/index.ts'), |
| 32 | + input: resolve("./src/index.ts"), |
33 | 33 | output: [ |
34 | | - outputConfig('', 'umd', { |
| 34 | + outputConfig("", "umd", { |
35 | 35 | globals: { |
36 | | - vue: 'Vue', |
37 | | - }, |
| 36 | + vue: "Vue" |
| 37 | + } |
38 | 38 | }), |
39 | | - outputConfig('.esm', 'esm'), |
40 | | - outputConfig('.common', 'cjs'), |
| 39 | + outputConfig(".esm", "esm"), |
| 40 | + outputConfig(".common", "cjs") |
41 | 41 | ], |
42 | 42 | external: [ |
43 | | - 'vue', |
44 | | - 'vue-router', |
45 | | - '@ionic/core', |
46 | | - '@ionic/core/loader', |
47 | | - 'ionicons', |
48 | | - 'ionicons/icons', |
| 43 | + "vue", |
| 44 | + "vue-router", |
| 45 | + "@ionic/core", |
| 46 | + "@ionic/core/loader", |
| 47 | + "ionicons", |
| 48 | + "ionicons/icons" |
49 | 49 | ], |
50 | 50 | plugins: [ |
51 | 51 | vue(), |
52 | 52 | typescript({ |
53 | 53 | useTsconfigDeclarationDir: true, |
54 | | - objectHashIgnoreUnknownHack: true, |
| 54 | + objectHashIgnoreUnknownHack: false, |
55 | 55 | clean: true |
56 | 56 | }) |
57 | | - ], |
58 | | - } |
| 57 | + ] |
| 58 | + }; |
59 | 59 | } |
60 | 60 |
|
61 | 61 | export default args => { |
62 | | - const configs = [baseConfig()] |
| 62 | + const configs = [baseConfig()]; |
63 | 63 |
|
64 | 64 | if (args.configProd === true) { |
65 | | - const prodConfig = baseConfig() |
66 | | - prodConfig.plugins.push(terser()) |
| 65 | + const prodConfig = baseConfig(); |
| 66 | + prodConfig.plugins.push(terser()); |
67 | 67 |
|
68 | 68 | for (const item of prodConfig.output) { |
69 | | - item.file = item.file.replace('.js', '.min.js') |
70 | | - item.sourcemap = false |
| 69 | + item.file = item.file.replace(".js", ".min.js"); |
| 70 | + item.sourcemap = false; |
71 | 71 | } |
72 | 72 |
|
73 | | - configs.push(prodConfig) |
| 73 | + configs.push(prodConfig); |
74 | 74 | } |
75 | 75 |
|
76 | | - return configs |
77 | | -} |
| 76 | + return configs; |
| 77 | +}; |
0 commit comments