-
Notifications
You must be signed in to change notification settings - Fork 42
/
rollup.config.js
72 lines (65 loc) · 1.72 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
/* eslint-env node */
/* global require */
import rollupPluginBabel from 'rollup-plugin-babel';
import rollupPluginCommonJS from 'rollup-plugin-commonjs';
import rollupPluginReplace from 'rollup-plugin-replace';
import rollupPluginNodeResolve from 'rollup-plugin-node-resolve';
import rollupPluginString from 'rollup-plugin-string';
import version from './tools/version';
import packageJson from './package.json';
const banner = '/** ' + version.copyright + ' */\n';
const warnExceptions = {
THIS_IS_UNDEFINED: [
'spin.js', // https://github.com/fgnass/spin.js/issues/351
],
};
export default {
input: './src/index.js',
onwarn: function(warning, warn) {
const exceptions = warning.loc && warnExceptions[warning.code] || [];
if (!exceptions.some(name => warning.loc.file.endsWith(name))) {
warn(warning);
}
},
plugins: [
rollupPluginReplace({
PACKAGE_VERSION: JSON.stringify(version.combined),
DEBUG: false,
}),
rollupPluginString({
include: '**/*.glsl',
}),
rollupPluginNodeResolve(),
rollupPluginCommonJS({
include: [
'./node_modules/**',
'./vendor/js/**',
'./src/utils/SelectionParser.js',
'./src/utils/MiewCLIParser.js',
],
namedExports: {
'vendor/js/Smooth.js': ['Smooth'],
},
}),
rollupPluginBabel({
exclude: [
'./node_modules/**',
'./vendor/js/**',
'./src/utils/SelectionParser',
'./src/utils/MiewCLIParser.js',
],
}),
],
output: [{
format: 'umd',
name: 'Miew',
file: 'build/' + packageJson.main,
banner,
sourcemap: true,
}, {
format: 'es',
file: 'build/' + packageJson.module,
banner,
sourcemap: true,
}],
};