forked from hans/obsidian-citation-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
43 lines (40 loc) · 1.23 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
import typescript from '@rollup/plugin-typescript';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import json from '@rollup/plugin-json';
import replace from '@rollup/plugin-replace';
import webWorkerLoader from 'rollup-plugin-web-worker-loader';
export default {
input: 'src/main.ts',
output: {
dir: '.',
sourcemap: 'inline',
format: 'cjs',
exports: 'default',
},
external: ['obsidian', 'path', 'fs', 'util', 'events', 'stream', 'os'],
plugins: [
/**
* Chokidar hacks to get working with platform-general Electron build.
*
* HACK: Manually replace fsevents import. This is only available on OS X,
* and we need to make a platform-general build here.
*/
replace({
delimiters: ['', ''],
include: "node_modules/chokidar/**/*.js",
"require('fsevents')": "null",
"require('fs')": "require('original-fs')",
}),
typescript(),
nodeResolve({ browser: true }),
commonjs({ ignore: ['original-fs'] }),
json(),
webWorkerLoader({
targetPlatform: 'browser',
extensions: ['.ts'],
preserveSource: true,
sourcemap: true,
}),
],
};