Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ianbbqzy committed Nov 17, 2023
1 parent 8ebc81d commit b1e5118
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion options/firebase_config.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
21 changes: 20 additions & 1 deletion webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b1e5118

Please sign in to comment.