Skip to content

Commit

Permalink
refactor: remove unused files and polyfills
Browse files Browse the repository at this point in the history
  • Loading branch information
SunriseFox authored and Jack-Works committed Oct 10, 2019
1 parent b38be2a commit 1590dce
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 34 deletions.
12 changes: 10 additions & 2 deletions config-overrides/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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'}
Expand Down Expand Up @@ -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('<script src="/polyfill/browser-polyfill.min.js"></script>', '')
}
return new HtmlWebpackPlugin({
templateContent: fs.readFileSync(path.join(__dirname, './template.html'), 'utf8'),
templateContent,
inject: 'body',
...options,
})
Expand Down
22 changes: 0 additions & 22 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -1,22 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<script src="polyfill/browser-polyfill.min.js"></script>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<style>
body {
margin: 0;
background: #fafafa;
}
#root {
min-width: 100vw;
min-height: 100vh;
}
</style>
<title>Maskbook</title>
</head>
<body>
<div id="root"></div>
</body>
</html>
10 changes: 0 additions & 10 deletions public/popup.html

This file was deleted.

0 comments on commit 1590dce

Please sign in to comment.