-
Notifications
You must be signed in to change notification settings - Fork 563
Expand file tree
/
Copy pathrollup.config.mjs
More file actions
44 lines (40 loc) · 1.13 KB
/
rollup.config.mjs
File metadata and controls
44 lines (40 loc) · 1.13 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
import resolve from '@rollup/plugin-node-resolve';
import terser from '@rollup/plugin-terser';
const production = !process.env.ROLLUP_WATCH;
// Custom plugin to exclude dev-tool.js from production builds
const excludeDevTool = {
name: 'exclude-dev-tool',
load(id) {
if (production && id.endsWith('dev-tool.js')) {
return '';
}
return null;
},
};
export default {
input: 'bookmarks/frontend/index.js',
output: {
sourcemap: true,
format: 'iife',
name: 'linkding',
// Generate bundle in static folder to that it is picked up by Django static files finder
file: 'bookmarks/static/bundle.js',
},
plugins: [
excludeDevTool,
// If you have external dependencies installed from
// npm, you'll most likely need these plugins. In
// some cases you'll need additional configuration —
// consult the documentation for details:
// https://github.com/rollup/rollup-plugin-commonjs
resolve({
browser: true,
}),
// If we're building for production (npm run build
// instead of npm run dev), minify
production && terser(),
],
watch: {
clearScreen: false,
},
};