-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
56 lines (54 loc) · 1.71 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
const typescript = require('@rollup/plugin-typescript');
const replace = require('@rollup/plugin-replace');
const analyze = require('rollup-plugin-analyzer');
const postcss = require('rollup-plugin-postcss');
const cssnano = require('cssnano');
const { swc } = require('rollup-plugin-swc3');
const development = process.env.ROLLUP_WATCH === 'true';
module.exports = {
input: 'src/index.ts',
output: {
file: 'dist/main.js',
format: 'iife',
name: 'Instantgram',
sourcemap: false,
},
plugins: [
replace({
'process.env.DEV': JSON.stringify(development),
'process.env.VERSION': JSON.stringify(require('./package.json').version),
preventAssignment: true,
}),
typescript({
tsconfig: './tsconfig.json',
sourceMap: false,
}),
swc({
jsc: {
parser: {
syntax: 'typescript',
tsx: false,
},
transform: {},
target: 'esnext',
},
sourceMaps: false,
minify: true
}),
postcss({
plugins: [
cssnano({
preset: 'default',
}),
],
minimize: true, // Minimize the CSS output
inject: false, // Optional: if you want to extract the CSS to a separate file
}),
analyze({ summaryOnly: true })
],
onwarn: (warning, warn) => {
if (warning.code === 'CIRCULAR_DEPENDENCY') return;
if (warning.code === 'PLUGIN_WARNING' && warning.plugin === 'typescript' && /sourcemap/.test(warning.message)) return;
warn(warning);
},
};