-
Notifications
You must be signed in to change notification settings - Fork 4
/
rollup.config.js
160 lines (150 loc) · 4.13 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
/**
* Export der Komponente läuft über "rollup"
* Das scheint die einzige Möglichkeit zu sein die funktioniert
*
* Weitere Infos:
* https://rollupjs.org/guide/en/
*
* Cheat-Sheet:
* https://devhints.io/rollup
*/
import typescript from 'rollup-plugin-typescript2'
import pkg from './package.json'
import commonjs from '@rollup/plugin-commonjs' // Convert CommonJS modules to ES6
import vue from 'rollup-plugin-vue' // Handle .vue SFC files
import resolve from '@rollup/plugin-node-resolve'
import del from 'rollup-plugin-delete'
import css from 'rollup-plugin-css-porter'
import sass from 'rollup-plugin-sass'
import babel from '@rollup/plugin-alias'
import { terser } from "rollup-plugin-terser"
import alias from '@rollup/plugin-alias'
import image from '@rollup/plugin-image'
const name = "MobiAdComponents"
const lib = 'mobiad-components'
const globals = {
'tslib': 'tslib',
'vue-property-decorator': 'vuePropertyDecorator',
'@mmit/logging': 'logging',
'spark-md5': 'SparkMD5'
}
export default {
input: 'src/index.ts', // our source file
output: [
{
// Keep the bundle as an ES module file, suitable for other bundlers
// and inclusion as a <script type=module> tag in modern browsers
name,
file: `lib/${lib}.esm.js`,
format: 'esm', // the preferred format
sourcemap: true
},
// {
// // Behält die directory struktur bei...
// // package.json: {
// // "module": "./lib/esm-split/index.js",
// // "typings": "./lib/esm-split/index.d.ts",
// // }
// name,
// dir: `lib/esm-split`,
// format: 'esm', // the preferred format
// sourcemap: true,
// preserveModules: true,
// preserveModulesRoot: 'src',
// plugins: [terser({
// compress: {
// unused: false,
// collapse_vars: false
// },
// ecma: 2019,
// // safari10: true,
// })]
// },
// {
// // Universal Module Definition, works as amd, cjs and iife all in one
// name,
// file: `lib/umd/index.js`,
// format: 'umd',
// sourcemap: true,
// globals,
// exports: 'named',
// },
{
// 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.)
name,
file: `lib/${lib}.min.js`,
format: 'iife',
sourcemap: true,
plugins: [terser()],
globals,
exports: 'named'
},
{
// CommonJS, suitable for Node and other bundlers
name,
file: `lib/${lib}.cjs.js`,
format: 'cjs',
sourcemap: true,
globals,
exports: 'named'
}
],
// Unterdrückt die Fehlermeldung "Mixing named and default exports"
// (Kommt von index.ts - da wird das so gemacht)
// exports: 'named',
external: [
...Object.keys(pkg.dependencies || {}),
// "vue-class-component",
// "vue-property-decorator",
"tslib",
"vue",
"vuex",
"vuex-class",
"vuetify",
"vuetify/lib"
],
plugins: [
alias({
'@': __dirname + '/src/main'
}),
typescript({
// objectHashIgnoreUnknownHack: true,
typescript: require('typescript'),
module: 'esnext',
tsconfig: "tsconfig.json",
tsconfigOverride: {
exclude: [
"node_modules",
"tests",
"src/main.ts",
"src/router.ts",
"src/plugins",
"src/simulations",
"src/views"
]
}
}),
babel({
exclude: 'node_modules/**',
sourceMaps: 'both'
}),
// [Rollup Plugin Vue](https://rollup-plugin-vue.vuejs.org/)
vue({
preprocessStyles: true,
// css: true, // Dynamically inject css as a <style> tag
// compileTemplate: true, // Explicitly convert template to render function
defaultLang: {script: 'ts'}
}),
sass(),
image(),
css(),
resolve(),
// terser() // minifies generated bundles
commonjs(),
del({
targets: 'lib/main.d.ts',
hook: 'generateBundle'
})
]
}