forked from BuilderIO/builder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.ts
59 lines (54 loc) · 1.56 KB
/
rollup.config.ts
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 replace from 'rollup-plugin-replace';
import serve from 'rollup-plugin-serve';
import esbuild from 'rollup-plugin-esbuild';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import json from '@rollup/plugin-json';
import common from '@rollup/plugin-commonjs';
const SERVE = process.env.SERVE === 'true';
const pkg = require('./package.json');
const libraryName = 'plugin';
export default {
input: `src/${libraryName}.ts`,
// Important! We need to have shared references to 'react' and '@builder.io/sdk'
// for builder plugins to run properly
// Do not change these! If you install new dependenies, that is ok, they should be
// left out of this list
external: [
'react',
'@builder.io/react',
'@builder.io/sdk',
'@builder.io/app-context',
'@material-ui/core',
'@emotion/core',
'@emotion/styled',
'mobx',
'react-dom',
'mobx-react',
],
output: [{ file: pkg.unpkg, format: 'system', sourcemap: true }],
watch: {
include: 'src/**',
},
plugins: [
replace({
'process.env.NODE_ENV': JSON.stringify('production'),
}),
json(),
nodeResolve({ mainFields: ['module', 'browser'] }),
common(),
esbuild(),
...(SERVE
? [
serve({
contentBase: 'dist',
port: 1268,
headers: {
'Access-Control-Allow-Origin': '*',
// https://developer.chrome.com/blog/private-network-access-preflight/#new-in-pna
'Access-Control-Allow-Private-Network': 'true',
},
}),
]
: []),
],
};