-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrollup.examples.config.js
More file actions
72 lines (69 loc) · 1.76 KB
/
rollup.examples.config.js
File metadata and controls
72 lines (69 loc) · 1.76 KB
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
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import replace from '@rollup/plugin-replace';
import html from '@rollup/plugin-html';
import copy from 'rollup-plugin-copy';
import postcss from 'rollup-plugin-postcss';
import ts from "rollup-plugin-ts";
const template = `
<!DOCTYPE html>
<html lang="en">
<head>
<base href="http://fakelocal.com:3000/" />
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<meta name="color-scheme" content="dark light">
<title>ReactAuth Test</title>
</head>
<body>
<div id="root"></div>
<script src="https://unpkg.com/react@17/umd/react.development.js" crossorigin></script>
<script src="https://unpkg.com/react-dom@17/umd/react-dom.development.js" crossorigin></script>
<script src="https://unpkg.com/react-router-dom@5.3.0/umd/react-router-dom.min.js"></script>
<script src="example.js"></script>
</body>
</html>
`;
export default {
input: './src/examples/Example.tsx',
output: {
dir: 'dist',
name: 'ReactAuth',
sourcemap: true,
format: 'umd',
globals: {
'react': 'React',
'react-dom': 'ReactDOM',
'react-router-dom': 'ReactRouterDOM'
},
},
external: ['react', 'react-dom', 'react-router-dom'],
plugins: [
replace({
preventAssignment: true,
values: {
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
}
}),
postcss({
extract: false,
use: ['sass']
}),
ts(),
commonjs(),
resolve({
browser: true
}),
html({
template: () => template
}),
copy({
targets: [
{ src: 'assets/*', dest: 'dist/assets/' }
]
})
]
};