forked from calebdwilliams/construct-style-sheets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
44 lines (42 loc) · 1.03 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
const tsc = require('@rollup/plugin-typescript');
const cleanup = require('rollup-plugin-cleanup');
const copy = require('rollup-plugin-copy');
const nodeResolve = require('@rollup/plugin-node-resolve').default;
const injectCode = require('./plugins/rollup-plugin-inject-code');
const extensions = ['.ts', '.js'];
module.exports = {
input: 'src/index.ts',
output: {
file: 'dist/adoptedStyleSheets.js',
format: 'iife',
name: 'adoptedStyleSheets',
},
plugins: [
nodeResolve({
extensions,
}),
tsc({
isolatedModules: true,
tsconfig: require.resolve('./tsconfig.build.json'),
}),
cleanup({
extensions,
}),
copy({
targets: [
{
src: 'src/typings.d.ts',
dest: 'dist',
rename: 'adoptedStyleSheets.d.ts',
},
],
}),
injectCode({
'adoptedStyleSheets.js': {
line: 3,
code:
" if (typeof document === 'undefined' || 'adoptedStyleSheets' in document) { return; }\n",
},
}),
],
};