Add build mode for edge languages

This commit is contained in:
Ajay
2022-01-14 16:07:24 -05:00
parent 35da572f3f
commit a82062da5b
2 changed files with 22 additions and 0 deletions

View File

@@ -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());