Skip to content

Commit

Permalink
Fix firefox specific features that were failing to activate
Browse files Browse the repository at this point in the history
  • Loading branch information
Bill13579 committed Sep 5, 2024
1 parent 9a4e773 commit 1c8333a
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 2 deletions.
47 changes: 47 additions & 0 deletions firefox.webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
const path = require("path");
const {DefinePlugin} = require("webpack");
const CircularDependencyPlugin = require('circular-dependency-plugin');

module.exports = {
mode: "production",
resolve: {
alias: {
Polyfill: path.resolve(__dirname, "src/polyfill.js")
},
modules: [path.resolve(__dirname, "src"), "node_modules"]
},
entry: {
"background/background": "./src/background/background.js",
"background/captureTab": "./src/background/captureTab.js",
"background/tmpClear": "./src/background/tmpClear.js",
"background/commands": "./src/background/commands.js",
"popup/popup": "./src/popup/popup.js",
"content/content": "./src/content/content.js",
"options/options": "./src/options/options.js"
},
output: {
filename: "[name].js",
path: path.resolve(__dirname, "dist")
},
plugins: [
new CircularDependencyPlugin({
exclude: /node_modules|cartographer\/pkg/,
failOnError: true,
allowAsyncCycles: false,
cwd: process.cwd()
}),
new DefinePlugin({
TARGET: "\"firefox\""
})
],
experiments: {
asyncWebAssembly: true,
// buildHttp: true,
// layers: true,
// lazyCompilation: true,
// outputModule: true,
// syncWebAssembly: true,
topLevelAwait: true,
},
cache: false,
};
47 changes: 47 additions & 0 deletions firefox.webpack.dev.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
const path = require("path");
const {DefinePlugin} = require("webpack");
const CircularDependencyPlugin = require('circular-dependency-plugin');

module.exports = {
mode: "development",
devtool: "cheap-module-source-map",
resolve: {
alias: {
Polyfill: path.resolve(__dirname, "src/polyfill.js")
},
modules: [path.resolve(__dirname, "src"), "node_modules"]
},
entry: {
"background/background": "./src/background/background.js",
"background/captureTab": "./src/background/captureTab.js",
"background/tmpClear": "./src/background/tmpClear.js",
"background/commands": "./src/background/commands.js",
"popup/popup": "./src/popup/popup.js",
"content/content": "./src/content/content.js",
"options/options": "./src/options/options.js"
},
output: {
filename: "[name].js",
path: path.resolve(__dirname, "dist")
},
plugins: [
new CircularDependencyPlugin({
exclude: /node_modules|cartographer\/pkg/,
failOnError: true,
allowAsyncCycles: false,
cwd: process.cwd()
}),
new DefinePlugin({
TARGET: "\"firefox\""
})
],
experiments: {
asyncWebAssembly: true,
// buildHttp: true,
// layers: true,
// lazyCompilation: true,
// outputModule: true,
// syncWebAssembly: true,
topLevelAwait: true,
},
};
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"build:chrome.dev": "npm run build:cartographer && webpack --config chrome.webpack.dev.config.js && npm run gen-manifest:chrome",
"build:webext": "npm run build:cartographer && webpack --config webext.webpack.config.js && npm run gen-manifest:webext",
"build:webext.dev": "npm run build:cartographer && webpack --config webext.webpack.dev.config.js && npm run gen-manifest:webext",
"build:firefox": "npm run build:webext",
"build:firefox.dev": "npm run build:webext.dev",
"build:firefox": "npm run build:cartographer && webpack --config firefox.webpack.config.js && npm run gen-manifest:firefox",
"build:firefox.dev": "npm run build:cartographer && webpack --config firefox.webpack.dev.config.js && npm run gen-manifest:firefox",
"build:v2-compat": "node build-v2-compat",
"clean:background": "rimraf dist/background/background.js* dist/background/captureTab.js* dist/background/commands.js* dist/background/tmpClear.js*",
"clean:content": "rimraf dist/content/content.js*",
Expand Down

0 comments on commit 1c8333a

Please sign in to comment.