forked from ilyvion/barter-vg-enhancer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
37 lines (34 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
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import terser from '@rollup/plugin-terser';
import metablock from 'rollup-plugin-userscript-metablock';
import pkg from './package.json'; // assert { type: 'json' };
import fs from 'fs';
// `npm run build` -> `production` is true
// `npm run dev` -> `production` is false
const production = !process.env.ROLLUP_WATCH;
fs.mkdir('dist/', { recursive: true }, () => null);
export default {
input: 'src/app.js',
output: {
file: 'dist/bundle.js',
format: 'iife', // immediately-invoked function expression — suitable for <script> tags
sourcemap: true,
},
plugins: [
resolve({ browser: true }), // tells Rollup how to find jquery in node_modules
commonjs(), // converts jquery to ES modules
production && terser(), // minify, but only in production
metablock({
file: './meta.json',
override: {
name: pkg.name,
version: pkg.version,
description: pkg.description,
homepage: pkg.homepage,
author: pkg.author,
license: pkg.license,
},
}),
],
};