forked from mattermost/mattermost-redux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
47 lines (40 loc) · 1.36 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
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import resolve from 'rollup-plugin-node-resolve';
import {terser} from 'rollup-plugin-terser';
import commonjs from 'rollup-plugin-commonjs';
import typescript from 'rollup-plugin-typescript2';
// eslint-disable-next-line no-process-env
const production = process.env.NODE_ENV === 'production';
const inputs = ['client4', 'websocket_client'];
// eslint-disable-next-line no-process-env
const buildFolder = process.env.OUTPUT_FOLDER || '.';
module.exports = inputs.map((input) => ({
input: `./src/client/${input}.ts`,
treeshake: Boolean(production),
output: [
{
format: 'cjs',
file: `${buildFolder}/mattermost.${input}.js`,
sourcemap: true,
exports: 'named',
}],
plugins: [
resolve(),
commonjs({
include: ['node_modules/**'],
}),
typescript({
tsconfigOverride: {
compilerOptions: {module: 'esnext'},
},
// eslint-disable-next-line global-require
typescript: require('ttypescript'),
rollupCommonJSResolveHack: true,
exclude: '**/__tests__/**',
clean: true,
}),
// only minify if in production
production && terser(),
],
}));