-
Notifications
You must be signed in to change notification settings - Fork 125
/
rollup.config.mjs
52 lines (50 loc) · 1.3 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
import * as url from 'url'
import terser from '@rollup/plugin-terser'
import alias from '@rollup/plugin-alias'
import { nodeResolve } from "@rollup/plugin-node-resolve"
const __dirname = url.fileURLToPath(new URL('.', import.meta.url))
export default [
{
input: "lib/assets/javascripts/src/local-time/index.js",
context: "window",
output: [
{
name: "LocalTime",
file: "app/assets/javascripts/local-time.es2017-umd.js",
format: "umd"
},
{
file: "app/assets/javascripts/local-time.es2017-esm.js",
format: "es"
}
],
plugins: [
nodeResolve({ extensions: [".js"] }),
terser()
],
watch: {
include: "lib/assets/javascripts/src/local-time/**/*"
}
},
{
input: "test/javascripts/src/index.js",
context: "window",
output: {
file: "test/javascripts/builds/index.js",
format: "iife"
},
plugins: [
alias({
entries: {
"local_time": `${__dirname}/app/assets/javascripts/local-time.es2017-esm.js`,
"moment": `${__dirname}/test/javascripts/vendor/moment.js`,
"sinon": `${__dirname}/test/javascripts/vendor/sinon.js`
}
}),
nodeResolve({ extensions: [".js"] })
],
watch: {
include: "test/javascripts/src/**/*"
}
}
]