Skip to content

Commit daf117e

Browse files
committed
rollup config + dist folder
Update .gitignore
1 parent 370b8a0 commit daf117e

File tree

3 files changed

+58
-1
lines changed

3 files changed

+58
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
*.log
22
node_modules
3+
dist

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"url": "https://github.com/JunoLab/language-weave/issues"
1515
},
1616
"homepage": "https://github.com/JunoLab/language-weave",
17-
"main": "lib/main.js",
17+
"main": "dist/main.js",
1818
"extensions": {
1919
".json": [
2020
"package.json"

rollup.config.js

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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+
// undetected named exports
16+
namedExports: {
17+
// left-hand side can be an absolute path, a path relative to the current directory, or the name of a module in node_modules
18+
},
19+
}),
20+
];
21+
22+
// minify only in production mode
23+
if (process.env.NODE_ENV === 'production') {
24+
plugins.push(
25+
// minify
26+
terser({
27+
ecma: 2018,
28+
warnings: true,
29+
compress: {
30+
drop_console: true,
31+
},
32+
})
33+
);
34+
}
35+
36+
export default [
37+
{
38+
input: 'lib/main.js',
39+
output: [
40+
{
41+
dir: "dist",
42+
format: 'cjs',
43+
sourcemap: true,
44+
},
45+
],
46+
// loaded externally
47+
external: [
48+
"atom-space-pen-views", // loaded because of errors
49+
"atom",
50+
// node stuff
51+
"fs",
52+
"path",
53+
],
54+
plugins: plugins,
55+
},
56+
];

0 commit comments

Comments
 (0)