diff --git a/firefox.webpack.config.js b/firefox.webpack.config.js new file mode 100644 index 0000000..968faf2 --- /dev/null +++ b/firefox.webpack.config.js @@ -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, +}; diff --git a/firefox.webpack.dev.config.js b/firefox.webpack.dev.config.js new file mode 100644 index 0000000..a9e4981 --- /dev/null +++ b/firefox.webpack.dev.config.js @@ -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, + }, +}; diff --git a/package.json b/package.json index 2be6c07..901ca50 100644 --- a/package.json +++ b/package.json @@ -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*",