From 1590dce8ea7907469ef2892aa06d0fff8f5fa8a7 Mon Sep 17 00:00:00 2001 From: SunriseFox Date: Mon, 23 Sep 2019 17:04:53 +0800 Subject: [PATCH] refactor: remove unused files and polyfills --- config-overrides/index.js | 12 ++++++++++-- public/index.html | 22 ---------------------- public/popup.html | 10 ---------- 3 files changed, 10 insertions(+), 34 deletions(-) delete mode 100644 public/popup.html diff --git a/config-overrides/index.js b/config-overrides/index.js index ddb9f3d616ed..e590cad49978 100644 --- a/config-overrides/index.js +++ b/config-overrides/index.js @@ -8,7 +8,7 @@ const src = file => path.join(__dirname, '../', file) /** * Polyfills that needs to be copied to dist */ -const polyfills = [ +let polyfills = [ 'node_modules/webextension-polyfill/dist/browser-polyfill.min.js', 'node_modules/webextension-polyfill/dist/browser-polyfill.min.js.map', 'src/polyfill/asmcrypto.js', @@ -48,6 +48,10 @@ const target = (argv => ({ WKWebview: (argv['wk-webview']), }))(require('yargs').argv) +if (target.Firefox) { + polyfills = polyfills.filter(name => !name.includes('webextension-polyfill')) +} + /** * @param config {import("webpack").Configuration} * @param env {'development' | 'production'} @@ -99,8 +103,12 @@ function override(config, env) { * @param {HtmlWebpackPlugin.Options} options */ function newPage(options = {}) { + let templateContent = fs.readFileSync(path.join(__dirname, './template.html'), 'utf8') + if (target.Firefox) { + templateContent = templateContent.replace('', '') + } return new HtmlWebpackPlugin({ - templateContent: fs.readFileSync(path.join(__dirname, './template.html'), 'utf8'), + templateContent, inject: 'body', ...options, }) diff --git a/public/index.html b/public/index.html index 92d8a6041800..e69de29bb2d1 100644 --- a/public/index.html +++ b/public/index.html @@ -1,22 +0,0 @@ - - - - - - - - Maskbook - - -
- - diff --git a/public/popup.html b/public/popup.html deleted file mode 100644 index 7dd2f1e7ab3e..000000000000 --- a/public/popup.html +++ /dev/null @@ -1,10 +0,0 @@ - - - Maskbook - - - -
- - -