diff --git a/.eslintrc.js b/.eslintrc.js index 68d30dcb3..515e575d6 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -26,7 +26,7 @@ module.exports = { 'test-*/**', 'docs/**', 'coverage/', - 'app/scripts/chromereload.js', + 'development/chromereload.js', 'app/vendor/**', 'test/e2e/send-eth-with-private-key-test/**', 'nyc_output/**', diff --git a/app/background.html b/app/background.html new file mode 100644 index 000000000..290576939 --- /dev/null +++ b/app/background.html @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/app/manifest/_base.json b/app/manifest/_base.json index 0b7caade1..2c8dcb715 100644 --- a/app/manifest/_base.json +++ b/app/manifest/_base.json @@ -1,14 +1,7 @@ { "author": "https://metamask.io", "background": { - "scripts": [ - "globalthis.js", - "initSentry.js", - "lockdown.js", - "runLockdown.js", - "bg-libs.js", - "background.js" - ], + "page": "background.html", "persistent": true }, "browser_action": { diff --git a/development/build/manifest.js b/development/build/manifest.js index 0dc8880b1..340db1272 100644 --- a/development/build/manifest.js +++ b/development/build/manifest.js @@ -8,10 +8,6 @@ const { createTask, composeSeries } = require('./task'); module.exports = createManifestTasks; -const scriptsToExcludeFromBackgroundDevBuild = { - 'bg-libs.js': true, -}; - function createManifestTasks({ browserPlatforms }) { // merge base manifest with per-platform manifests const prepPlatforms = async () => { @@ -35,29 +31,13 @@ function createManifestTasks({ browserPlatforms }) { ); }; - // dev: remove bg-libs, add chromereload, add perms + // dev: add perms const envDev = createTaskForModifyManifestForEnvironment((manifest) => { - const scripts = manifest.background.scripts.filter( - (scriptName) => !scriptsToExcludeFromBackgroundDevBuild[scriptName], - ); - scripts.push('chromereload.js'); - manifest.background = { - ...manifest.background, - scripts, - }; manifest.permissions = [...manifest.permissions, 'webRequestBlocking']; }); - // testDev: remove bg-libs, add perms + // testDev: add perms const envTestDev = createTaskForModifyManifestForEnvironment((manifest) => { - const scripts = manifest.background.scripts.filter( - (scriptName) => !scriptsToExcludeFromBackgroundDevBuild[scriptName], - ); - scripts.push('chromereload.js'); - manifest.background = { - ...manifest.background, - scripts, - }; manifest.permissions = [ ...manifest.permissions, 'webRequestBlocking', diff --git a/development/build/static.js b/development/build/static.js index d041d87ae..91d796310 100644 --- a/development/build/static.js +++ b/development/build/static.js @@ -80,13 +80,34 @@ const copyTargetsDev = [ pattern: '/chromereload.js', dest: ``, }, + // empty files to suppress missing file errors + { + src: './development/', + pattern: '/empty.js', + dest: `bg-libs.js`, + }, + { + src: './development/', + pattern: '/empty.js', + dest: `ui-libs.js`, + }, +]; + +const copyTargetsProd = [ + ...copyTargets, + // empty files to suppress missing file errors + { + src: './development/', + pattern: '/empty.js', + dest: `chromereload.js`, + }, ]; function createStaticAssetTasks({ livereload, browserPlatforms }) { const prod = createTask( 'static:prod', composeSeries( - ...copyTargets.map((target) => { + ...copyTargetsProd.map((target) => { return async function copyStaticAssets() { await performCopy(target); }; diff --git a/app/scripts/chromereload.js b/development/chromereload.js similarity index 100% rename from app/scripts/chromereload.js rename to development/chromereload.js diff --git a/development/empty.js b/development/empty.js new file mode 100644 index 000000000..eb710729b --- /dev/null +++ b/development/empty.js @@ -0,0 +1 @@ +// this file intentionally left blank : )