Skip to content

Commit

Permalink
fix: workaround FILE_TOO_LARGE via factor-bundle
Browse files Browse the repository at this point in the history
This is a simple workaround that encourages factor-bundle to do a more
even split that keeps .js files under 4MB limit.
  • Loading branch information
lidel committed May 16, 2018
1 parent 6fc89d6 commit c6840f7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions add-on/src/background/big-deps.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
'use strict'
/* eslint-env browser, webextensions */

// Problem: addons-linter does not permit .js bigger than 4MB (FILE_TOO_LARGE)
// Solution: this file lets us fine-tune to decide what to extract
// into a shared bundle created by browserify+factor-bundle

const Ipfs = require('ipfs')
// const IpfsApi = require('ipfs-api')
const node = new Ipfs({ start: false })
console.log('this code wont run :-)', node)
// console.log('fake api', IpfsApi)
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"build:copy:wx-polyfill-lib": "shx cp node_modules/webextension-polyfill/dist/browser-polyfill.min.js add-on/dist/contentScripts/browser-polyfill.min.js",
"build:js": "run-p build:js:*",
"build:js:gui": "browserify -p prundupify -g [ uglifyify --compress [ --inline=0 ] ] -t [ browserify-package-json --global ] add-on/src/popup/browser-action/index.js add-on/src/popup/page-action/index.js add-on/src/popup/quick-upload.js -p [ factor-bundle -o add-on/dist/popup/browser-action/browser-action.js -o add-on/dist/popup/page-action/page-action.js -o add-on/dist/popup/quick-upload.js] -o add-on/dist/ipfs-companion-gui-common.js",
"build:js:backend": "browserify -p prundupify -g [ uglifyify --compress [ --inline=0 ] ] -t [ browserify-package-json --global ] add-on/src/background/background.js add-on/src/options/options.js add-on/src/pages/proxy-acl/index.js add-on/src/pages/proxy-access-dialog/index.js -p [ factor-bundle -o add-on/dist/background/background.js -o add-on/dist/options/options.js -o add-on/dist/pages/proxy-acl/proxy-acl.js -o add-on/dist/pages/proxy-access-dialog/proxy-access-dialog.js ] -o add-on/dist/ipfs-companion-common.js",
"build:js:backend": "browserify -p prundupify -g [ uglifyify --compress [ --inline=0 ] ] -t [ browserify-package-json --global ] add-on/src/background/background.js add-on/src/background/big-deps.js add-on/src/options/options.js add-on/src/pages/proxy-acl/index.js add-on/src/pages/proxy-access-dialog/index.js -p [ factor-bundle -o add-on/dist/background/background.js -o add-on/dist/background/big-deps.js -o add-on/dist/options/options.js -o add-on/dist/pages/proxy-acl/proxy-acl.js -o add-on/dist/pages/proxy-access-dialog/proxy-access-dialog.js ] -o add-on/dist/ipfs-companion-common.js",
"build:content-scripts": "run-p build:content-scripts:*",
"build:content-scripts:ipfs-proxy": "run-s build:content-scripts:ipfs-proxy:*",
"build:content-scripts:ipfs-proxy:page": "browserify -p prundupify -g uglifyify -t [ browserify-package-json --global ] add-on/src/contentScripts/ipfs-proxy/page.js -o add-on/dist/contentScripts/ipfs-proxy/page.js",
Expand Down

0 comments on commit c6840f7

Please sign in to comment.