-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
66 lines (63 loc) · 1.74 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
60
61
62
63
64
65
66
import externals from 'rollup-plugin-node-externals';
import { fileURLToPath } from 'url';
import path from 'path';
import alias from '@rollup/plugin-alias';
import replace from '@rollup/plugin-replace';
import esbuild from 'rollup-plugin-esbuild';
import styles from 'rollup-plugin-styles';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
export default [
{
input: './bin/abdo.js',
output: {
format: 'es',
file: 'dist/bin/abdo.js',
banner: '#!/usr/bin/env node',
},
plugins: [externals({ include: ['terser', 'browserslist', '@rollup/pluginutils'] })],
},
{
input: './lib/toolbar/pptr-toolbar.jsx',
output: {
format: 'iife',
file: 'dist/lib/pptr-toolbar.js',
sourcemap: 'hidden',
},
plugins: [
alias({
entries: [
{ find: 'a-b-doer/hooks', replacement: path.join(__dirname, 'hooks') },
{ find: 'a-b-doer/internal', replacement: path.join(__dirname, 'internal') },
{ find: 'a-b-doer', replacement: path.join(__dirname, 'main') },
],
}),
replace({
preventAssignment: true,
values: {
'config.hooks': 'true',
'config.jsx': 'true',
'process.env.IE': 'false',
'process.env.NODE_ENV': JSON.stringify('development'),
'process.env.PREACT': 'false',
'process.env.TEST_ENV': 'false',
'process.env.TEST_ID': JSON.stringify('t-pptr-toolbar'),
'process.env.preact': 'false',
},
}),
esbuild({
sourceMap: false,
minify: false,
jsx: 'automatic',
jsxImportSource: path.join(__dirname, 'lib', 'toolbar'),
}),
styles({
modules: true,
mode: [
'inject',
{ container: 'body', singleTag: true, prepend: true, attributes: { id: 'pptr-toolbar-styles' } },
],
}),
],
},
];
console.log(path.join(__dirname, 'main'));