-
Notifications
You must be signed in to change notification settings - Fork 11
/
rollup.config.mjs
63 lines (52 loc) · 1.65 KB
/
rollup.config.mjs
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
/**
* Rollup config
*
* Creates the proper static files.
*/
import * as path from 'path'
import 'dotenv/config' // Load environment variables from .env
/////////////////////////////// Rollup plugins ///////////////////////////////
import terser from '@rollup/plugin-terser'
import resolve from '@rollup/plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import postcss from 'rollup-plugin-postcss'
///////////////////////////////// Constants //////////////////////////////////
const BUILD_DIR = 'generated/frontend/morphodict';
// Production mode when debug is false.
const production = !process.env.DEBUG;
/////////////////////////////////// Config ///////////////////////////////////
export default [ {
input: "frontend/index.js",
output: {
file: path.resolve( BUILD_DIR, "index.js"),
format: "iife",
sourcemap: true,
},
plugins: [
resolve(), // finds modules in node_modules
commonjs(), // make rollup understand require() statements
postcss({
// Save the CSS here.
extract: "styles.css",
minimize: production,
sourcemap: true,
}),
production && terser(), // minify, but only in production
],
strictDeprecations: true,
},
{
input: "frontend/click-in-text-embedded-test.js",
output: {
file: path.join(BUILD_DIR, "click-in-text-embedded-test.js"),
name: null, // The script does not export anything.
format: "iife",
sourcemap: true,
},
plugins: [
resolve(), // finds modules in node_modules
commonjs(), // make rollup understand require() statements
],
strictDeprecations: true,
},
];