Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit 004185a

Browse files
committed
rollup config
1 parent 52f570a commit 004185a

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

rollup.config.js

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import resolve from '@rollup/plugin-node-resolve'
2+
import commonjs from '@rollup/plugin-commonjs'
3+
import coffeescript from 'rollup-plugin-coffee-script'
4+
import {terser} from 'rollup-plugin-terser'
5+
6+
let plugins = [
7+
// if any (in deps as well): Convert CoffeeScript to JavaScript
8+
coffeescript(),
9+
10+
// so Rollup can find externals
11+
resolve({extensions: ['.js', '.coffee'], preferBuiltins: true}),
12+
13+
// so Rollup can convert externals to an ES module
14+
commonjs()
15+
]
16+
17+
// minify only in production mode
18+
if (process.env.NODE_ENV === 'production') {
19+
plugins.push(
20+
// minify
21+
terser({
22+
ecma: 2018,
23+
warnings: true,
24+
compress: {
25+
drop_console: false
26+
}
27+
})
28+
)
29+
}
30+
31+
export default [
32+
{
33+
input: 'lib/main',
34+
output: [
35+
{
36+
dir: 'dist',
37+
format: 'cjs',
38+
sourcemap: true
39+
}
40+
],
41+
// loaded externally
42+
external: [
43+
'atom',
44+
'pathwatcher',
45+
// node stuff
46+
'fs',
47+
'path'
48+
],
49+
plugins: plugins
50+
}
51+
]

0 commit comments

Comments
 (0)