forked from basecamp/local_time
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.mjs
55 lines (53 loc) · 1.4 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
import * as url from 'url'
import coffee from "rollup-plugin-coffee-script"
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.coffee",
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: [
coffee(),
nodeResolve({ extensions: [".coffee"] }),
terser()
],
watch: {
include: "lib/assets/javascripts/src/local-time/**/*"
}
},
{
input: "test/javascripts/src/index.coffee",
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`
}
}),
coffee(),
nodeResolve({ extensions: [".coffee"] })
],
watch: {
include: "test/javascripts/src/**/*"
}
}
]