-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrollup.config.js
More file actions
63 lines (58 loc) · 1.62 KB
/
rollup.config.js
File metadata and controls
63 lines (58 loc) · 1.62 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
import typescript from '@rollup/plugin-typescript';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import { terser } from 'rollup-plugin-terser';
const isProd = process.env.BUILD === 'production';
export default {
input: 'src/main.ts',
output: {
sourcemap: isProd ? false : 'inline',
format: 'cjs',
exports: 'default',
file: 'main.js'
},
external: [
'obsidian',
'electron',
'@codemirror/state',
'@codemirror/view'
],
plugins: [
typescript({
tsconfig: './tsconfig.json',
sourceMap: !isProd,
inlineSources: !isProd
}),
nodeResolve({
browser: true,
preferBuiltins: false
}),
commonjs(),
isProd && terser()
].filter(Boolean),
onwarn(warning, warn) {
// Suppress eval warnings from third-party plugins
if (warning.code === 'EVAL') {
const id = warning.id || '';
if (id.includes('editorjs-button') || id.includes('editorjs-hyperlink')) {
return;
}
}
// Suppress TypeScript warnings from @editorjs/footnotes
if (warning.plugin === 'typescript') {
const loc = warning.loc || {};
const file = loc.file || warning.id || '';
if (file.includes('@editorjs/footnotes') || file.includes('node_modules/@editorjs/footnotes')) {
return;
}
}
// Suppress plugin-specific warnings from third-party code
if (warning.pluginCode && warning.id) {
if (warning.id.includes('node_modules/@editorjs/footnotes')) {
return;
}
}
// Use default for everything else
warn(warning);
}
};