Skip to content

Commit 6f7a57b

Browse files
committed
improve rollup conf
1 parent 287b203 commit 6f7a57b

File tree

3 files changed

+24
-12
lines changed

3 files changed

+24
-12
lines changed

app.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,5 @@ app.get('/rip_quick_add_api', async (request, reply) => {
2727
});
2828

2929
(async () => {
30-
const port = 3000;
31-
await app.listen({ port });
32-
console.log(`Running on http://localhost:/${port}`);
30+
await app.listen({ port: 3000 });
3331
})();

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"description": "Quickly create Google Calendar events from natural language.",
55
"scripts": {
66
"test": "echo \"Error: no test specified\" && exit 1",
7-
"build": "rollup -c -i src/background.js -o chrome-extension/background.js && rollup -c -i src/popup.js -o chrome-extension/popup.js && rollup -c -i src/options.js -o chrome-extension/options.js",
8-
"watch": "rollup -c --watch -i src/background.js -o chrome-extension/background.js & rollup -c --watch -i src/popup.js -o chrome-extension/popup.js & rollup --watch -c -i src/options.js -o chrome-extension/options.js",
7+
"build": "rollup -c",
8+
"watch": "rollup -cw",
99
"server": "node app.js"
1010
},
1111
"type": "module",

rollup.config.mjs

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
11
import resolve from '@rollup/plugin-node-resolve';
22
import commonjs from '@rollup/plugin-commonjs';
33

4-
export default {
5-
plugins: [
6-
resolve(),
7-
commonjs({
8-
include: ['node_modules/**',]
9-
}),
10-
],
4+
const output = {
5+
format: 'iife',
6+
dir: 'chrome-extension',
117
};
8+
9+
const plugins = [
10+
resolve(),
11+
commonjs({
12+
include: ['node_modules/**',]
13+
}),
14+
];
15+
16+
const inputs = ['background.js', 'popup.js', 'options.js'];
17+
const config = inputs.map(i => {
18+
return {
19+
input: `src/${i}`,
20+
output,
21+
plugins
22+
};
23+
});
24+
25+
export default config;

0 commit comments

Comments
 (0)