-
Notifications
You must be signed in to change notification settings - Fork 122
/
Copy pathbase-rollup.config.js
104 lines (102 loc) · 2.4 KB
/
base-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
// Rollup plugins
import babel from 'rollup-plugin-babel';
import eslint from 'rollup-plugin-eslint';
import uglify from 'rollup-plugin-uglify';
import { minify } from 'uglify-es';
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import replace from 'rollup-plugin-replace';
import string from 'rollup-plugin-string';
import flow from 'rollup-plugin-flow';
// custom nearley plugin (for functional builds)
import nearley from 'rollup-plugin-walt-grammar';
const PROD = process.env.NODE_ENV === 'production';
export default {
plugins: [
nearley(),
eslint({
exclude: ['**/*.ne']
}),
flow(),
string({
include: '**/*.walt',
}),
replace({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
}),
babel({
babelrc: false,
presets: [
[
'env',
{
modules: false,
targets: {
chrome: '60.0.0',
},
},
],
],
plugins: [
'external-helpers',
'transform-object-rest-spread',
'transform-node-env-inline',
['minify-dead-code-elimination', { 'keepFnArgs': true }]
],
}),
resolve({
jail: __dirname,
main: false,
}),
commonjs({
namedExports: {
'node_modules/walt-compiler/dist/walt.js': [
'unstableCompileWalt',
'fragment',
'parser',
],
'node_modules/wasm-types/index.js': [
'i32',
'i64',
'f32',
'f64',
'anyfunc',
'func',
'block_type',
'i8',
'u8',
'i16',
'u16',
'u32',
'u64',
'set',
'get',
'sizeof',
],
'node_modules/walt-parser-tools/scope.js': [
'enter',
'exit',
'current',
'find',
'add',
'index',
'namespace',
'signature',
],
'node_modules/walt-parser-tools/map-node.js': ['map', 'mapNode'],
'node_modules/walt-syntax/dist/walt-syntax.js': [
'tokens',
'semantics',
'builtinTypes',
'statements',
'i32',
'f32',
'i64',
'f64',
],
'node_modules/nearley/lib/nearley.js': ['Parser', 'Grammar'],
},
}),
PROD && uglify({}, minify),
],
};