Skip to content

Commit 11f5efe

Browse files
committedJun 20, 2019
move bundles to dist folder and make minification optional
1 parent 8262aec commit 11f5efe

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed
 

‎.gitignore

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
11
node_modules/
2-
background.bundle.js
3-
background.bundle.js.map
4-
content-script.bundle.js
5-
content-script.bundle.js.map
2+
dist/

‎manifest.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
},
1818
"permissions": [ "http://*/*", "https://*/*","tabs", "activeTab", "webRequest", "webRequestBlocking","unlimitedStorage", "webNavigation", "<all_urls>"],
1919
"background": {
20-
"scripts": ["background.bundle.js"]
20+
"scripts": ["./dist/background.bundle.js"]
2121
},
2222
"content_scripts": [{
2323
"matches" : ["http://*/*", "https://*/*"],
2424
"match_about_blank": true,
25-
"js": ["content-script.bundle.js"],
25+
"js": ["./dist/content-script.bundle.js"],
2626
"all_frames": true,
2727
"run_at": "document_end"
2828
}],

‎package.json

+6-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@
22
"description": "Local sheriff is a reconnaissance tool in your browser for your data.",
33
"main": "background.js",
44
"scripts": {
5-
"build": "rollup --config rollup.config.js",
5+
"clean": "rm -frv dist",
6+
"build": "rollup --config rollup.config.js --environment BUILD:production",
7+
"prestart": "npm run clean",
68
"watch": "rollup --config rollup.config.js --watch",
9+
"prestart": "npm run clean",
710
"lint": "web-ext lint",
8-
"start": "concurrently 'npm run watch' 'web-ext run --source-dir . --firefox /usr/bin/firefox'"
11+
"start": "concurrently 'npm run watch' 'web-ext run --source-dir . --firefox /usr/bin/firefox'",
12+
"prestart": "npm run clean"
913
},
1014
"repository": {
1115
"type": "git",

‎rollup.config.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,25 @@ import resolve from 'rollup-plugin-node-resolve';
33
import json from 'rollup-plugin-json';
44
import compiler from '@ampproject/rollup-plugin-closure-compiler';
55

6+
const mode = process.env.BUILD === 'production' ? 'production' : 'development';
7+
68
const plugins = [
79
json(),
810
resolve({
911
preferBuiltins: false,
1012
}),
1113
commonjs(),
12-
compiler(),
1314
];
1415

16+
if (mode === 'production') {
17+
plugins.push(compiler());
18+
}
19+
1520
export default [
1621
{
1722
input: './background.js',
1823
output: {
19-
file: 'background.bundle.js',
24+
file: './dist/background.bundle.js',
2025
format: 'iife',
2126
name: 'localSheriff',
2227
sourcemap: true,
@@ -26,7 +31,7 @@ export default [
2631
{
2732
input: './scripts/content-script.js',
2833
output: {
29-
file: 'content-script.bundle.js',
34+
file: './dist/content-script.bundle.js',
3035
format: 'iife',
3136
name: 'localSheriff',
3237
sourcemap: true,

0 commit comments

Comments
 (0)
Please sign in to comment.