-
Notifications
You must be signed in to change notification settings - Fork 27
/
rollup.config.js
59 lines (47 loc) · 1.27 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
import { createRequire } from 'module';
import replace from '@rollup/plugin-replace';
import typescript from '@rollup/plugin-typescript';
const require = createRequire(import.meta.url);
const { version } = require('./package.json');
const output = {
format: 'es',
banner: `/**\n * Copyright (C) 2023 Salesforce.com, Inc.\n */`,
footer: `/** version: ${version} */`
};
const onwarn = ({ code, message }) => {
if (code !== 'CIRCULAR_DEPENDENCY') {
throw new Error(message); // make all warnings into errors
}
};
const typescriptPlugin = typescript({
tsconfig: './tsconfig.json',
noEmitOnError: false // make typescript errors actual errors
})
export default [
{
input: 'src/main.ts',
output: {
...output,
file: 'dist/observable-membrane.js',
},
plugins: [
typescriptPlugin,
],
onwarn
},
{
input: 'src/main.ts',
output: {
...output,
file: 'dist/observable-membrane.prod.js',
},
plugins: [
replace({
'process.env.NODE_ENV': JSON.stringify('production'),
preventAssignment: true,
}),
typescriptPlugin,
],
onwarn
},
];