forked from zhw2590582/WFPlayer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
58 lines (56 loc) · 1.81 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
import babel from 'rollup-plugin-babel';
import commonjs from 'rollup-plugin-commonjs';
import nodeResolve from 'rollup-plugin-node-resolve';
import { eslint } from 'rollup-plugin-eslint';
import replace from 'rollup-plugin-replace';
import { uglify } from 'rollup-plugin-uglify';
import workerInline from 'rollup-plugin-worker-inline';
import { version, homepage } from './package.json';
const isProd = process.env.NODE_ENV === 'production';
export default {
input: 'src/index.js',
output: {
name: 'WFPlayer',
file: isProd ? 'dist/wfplayer.js' : 'docs/uncompiled/wfplayer.js',
format: 'umd',
sourcemap: !isProd,
},
plugins: [
eslint({
exclude: ['node_modules/**'],
}),
nodeResolve(),
commonjs(),
workerInline(),
babel({
runtimeHelpers: true,
exclude: 'node_modules/**',
presets: [
[
'@babel/preset-env',
{
modules: false,
},
],
],
plugins: ['@babel/plugin-external-helpers', '@babel/plugin-transform-runtime'],
}),
replace({
exclude: 'node_modules/**',
__ENV__: JSON.stringify(process.env.NODE_ENV || 'development'),
__VERSION__: version,
}),
isProd &&
uglify({
output: {
preamble:
'/*!\n' +
` * WFPlayer.js v${version}\n` +
` * Github: ${homepage}\n` +
` * (c) 2017-${new Date().getFullYear()} Harvey Zack\n` +
' * Released under the MIT License.\n' +
' */\n',
},
}),
],
};