-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
rollup.config.js
60 lines (56 loc) · 1.67 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
const isDev = process.env.NODE_ENV === 'development'
const isModern = process.env.BROWSERSLIST_ENV === 'modern'
const vue = require('rollup-plugin-vue')
const uglify = require('rollup-plugin-terser').terser
const nodeResolve = require('rollup-plugin-node-resolve')
const json = require('rollup-plugin-json')
const commonJs = require('rollup-plugin-commonjs')
const babel = require('rollup-plugin-babel')
const license = require('rollup-plugin-license')
module.exports = {
input: './resources/js/main.js',
output: {
file: isModern ? './dist/js/main.js' : './dist/js/main.legacy.js',
format: 'iife',
external: {
Urlify: 'Urlify',
AWES: 'AWES',
Hammer: 'Hammer'
}
},
plugins: [
vue({
css: false,
template: {
compilerOptions: {
whitespace: 'condense',
preserveWhitespace: false
}
}
}),
commonJs({
include: 'node_modules/**'
}),
nodeResolve({
mainFields: ['module', 'main', 'jsnext:main']
}),
json()
]
}
if ( ! isModern ) {
module.exports.plugins.push(
babel({
exclude: 'node_modules/**',
runtimeHelpers: true,
extensions: ['.js', '.vue']
})
)
}
if ( ! isDev ) {
module.exports.plugins = module.exports.plugins.concat([
uglify(),
license({
banner: "Bundle of AWES <%= pkg.name %> " + (isModern ? '' : 'transpiled and polyfilled') + " \n Generated: <%= moment().format('YYYY-MM-DD HH:mm:ss') %> \n Version: <%= pkg.version %>"
})
])
}