-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
75 lines (69 loc) · 2.22 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
import path from 'path'
import resolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import terser from '@rollup/plugin-terser'
import strip from '@rollup/plugin-strip'
const isProduction = process.env.NODE_ENV === 'production'
if (isProduction) console.log('✨ Production BUILD')
const name = 'v_is_empty_value'
const formats = [
'amd', // Asynchronous Module Definition, used with module loaders like RequireJS
'cjs', // CommonJS, suitable for Node and Browserify/Webpack
'es', // Keep the bundle as an ES module file, suitable for other bundlers and inclusion as a <script type=module> tag in modern browsers
'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.)
'umd', // Universal Module Definition, works as amd, cjs and iife all in one
'system' // Native format of the SystemJS loader
]
const banner = `//! 📚 Package: ${name} \n//! 👨💻 Author: V-core9`
const footer = `//! - - - - -<[:-v-:]>- - - - - `
const buildConfig = {
input: path.resolve(__dirname, `./src/index.js`),
treeshake: 'smallest',
output: [
// 3 Versions output
...formats.map((format) => ({
file: `./dist/${format}.js`,
name,
banner,
footer,
format,
sourcemap: true,
minifyInternalExports: true,
sanitizeFileName: true,
generatedCode: {
arrowFunctions: true,
constBindings: true,
conciseMethodProperty: true,
objectShorthand: true,
parameterDestructuring: true,
reservedNamesAsProps: true,
stickyRegExp: true,
templateString: true
}
// experimentalMinChunkSize: 1000
}))
],
plugins: [
resolve(),
commonjs(),
...(isProduction
? [
terser({
maxWorkers: 4,
compress: {
// booleans_as_integers: true,
ecma: 2015
}
}),
strip({
//labels: ['unittest'],
debugger: true
})
]
: [])
// babel({
// exclude: 'node_modules/**'
// })
]
}
export default buildConfig