aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAjay <[email protected]>2022-01-14 16:07:24 -0500
committerAjay <[email protected]>2022-01-14 16:07:24 -0500
commita82062da5b7903d4b9f82f4abd02e5daf4a30436 (patch)
treed5ed8d06597bffc242adf6a8815120537a148e8a
parent35da572f3f5cfecab2b9cea580bcac9f1c14d3a6 (diff)
downloadSponsorBlock-a82062da5b7903d4b9f82f4abd02e5daf4a30436.tar.gz
SponsorBlock-a82062da5b7903d4b9f82f4abd02e5daf4a30436.zip
Add build mode for edge languages
-rw-r--r--package.json1
-rw-r--r--webpack/webpack.common.js21
2 files changed, 22 insertions, 0 deletions
diff --git a/package.json b/package.json
index 740ab7a1..3801193a 100644
--- a/package.json
+++ b/package.json
@@ -47,6 +47,7 @@
"build:chrome": "webpack --env.browser=chrome --config webpack/webpack.prod.js",
"build:firefox": "webpack --env.browser=firefox --config webpack/webpack.prod.js",
"build:safari": "webpack --env.browser=safari --config webpack/webpack.prod.js",
+ "build:edge": "webpack --env.browser=edge --config webpack/webpack.prod.js",
"build:dev": "npm run build:dev:chrome",
"build:dev:chrome": "webpack --env.browser=chrome --config webpack/webpack.dev.js",
"build:dev:firefox": "webpack --env.browser=firefox --config webpack/webpack.dev.js",
diff --git a/webpack/webpack.common.js b/webpack/webpack.common.js
index 7f0d64ac..cacb07ba 100644
--- a/webpack/webpack.common.js
+++ b/webpack/webpack.common.js
@@ -5,6 +5,22 @@ const BuildManifest = require('./webpack.manifest');
const srcDir = '../src/';
const fs = require("fs");
+const edgeLanguages = [
+ "de",
+ "en",
+ "es",
+ "fr",
+ "pl",
+ "pt_BR",
+ "ro",
+ "ru",
+ "sk",
+ "sv",
+ "tr",
+ "uk",
+ "zh_CN"
+]
+
module.exports = env => ({
entry: {
popup: path.join(__dirname, srcDir + 'popup.ts'),
@@ -49,6 +65,11 @@ module.exports = env => ({
context: './public',
filter: async (path) => {
if (path.match(/\/_locales\/.+/)) {
+ if (env.browser.toLowerCase() === "edge"
+ && !edgeLanguages.includes(path.match(/(?<=\/_locales\/)[^/]+(?=\/[^/]+$)/)[0])) {
+ return false;
+ }
+
const data = await fs.promises.readFile(path);
const parsed = JSON.parse(data.toString());