diff --git a/options/firebase_config.js b/options/firebase_config.js index 298512c..caf1c1d 100644 --- a/options/firebase_config.js +++ b/options/firebase_config.js @@ -1,6 +1,6 @@ // Import the functions you need from the SDKs you need import { initializeApp } from "firebase/app"; -import { getAnalytics } from "firebase/analytics"; +// import { getAnalytics } from "firebase/analytics"; import 'dotenv/config' // TODO: Add SDKs for Firebase products that you want to use diff --git a/package.json b/package.json index 16b5d87..8af7901 100644 --- a/package.json +++ b/package.json @@ -4,9 +4,11 @@ "release": "webpack --config webpack.production.js" }, "devDependencies": { + "@babel/core": "^7.23.3", "clean-webpack-plugin": "^4.0.0", "copy-webpack-plugin": "^10.2.3", "html-webpack-plugin": "^5.5.0", + "replace-in-file-webpack-plugin": "^1.0.6", "webpack": "^5.88.2", "webpack-cli": "^4.10.0" }, diff --git a/webpack.common.js b/webpack.common.js index bc4a5e3..e935feb 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -5,7 +5,7 @@ const CopyWebpackPlugin = require('copy-webpack-plugin'); var webpack = require('webpack'); const NodePolyfillPlugin = require('node-polyfill-webpack-plugin') require('dotenv').config({ path: './.env' }); - +const ReplaceInFileWebpackPlugin = require('replace-in-file-webpack-plugin') module.exports = { // Note: // Chrome MV3 no longer allowed remote hosted code @@ -75,6 +75,25 @@ module.exports = { new webpack.DefinePlugin({ "process.env": JSON.stringify(process.env), }), + + new ReplaceInFileWebpackPlugin([{ + dir: 'dist', + files: ['options.js', 'signin.js', 'firebase_config.js'], + rules: [ + { + search: 'https://apis.google.com/js/api.js?onload=${cbName}', + replace: '', + }, + { + search: 'https://www.google.com/recaptcha/enterprise.js?render=', + replace: '', + }, + { + search: 'https://www.googletagmanager.com/gtag/js', + replace: '', + }, + ] + }]), ], output: { // chrome load uppacked extension looks for files under dist/* folder