Skip to content

Commit

Permalink
Improved webpack config and fixed error
Browse files Browse the repository at this point in the history
  • Loading branch information
Sallaa committed Aug 13, 2024
1 parent 0faa08f commit daf6797
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/components/Shared/ReverseSearch/utils/openTabUtils.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@ const openTabsSearch = (url) => {
};

function ns(url) {
let domain = new URL(url);
return domain.hostname.replace("www.", "");
if (!url || typeof url !== "string") return;
return new URL(url).hostname.replace("www.", "");
}
19 changes: 8 additions & 11 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ module.exports = {
path: path.resolve(__dirname, "build"),
filename: "[name].js",
iife: false,

},
// optimization: {
// runtimeChunk: 'single',
Expand All @@ -25,8 +24,7 @@ module.exports = {
rules: [
{
test: /\.(js|jsx)$/,
//include: path.resolve(__dirname, 'src'),
exclude: "/node/node_modules",
exclude: /node_modules/,
use: {
loader: "babel-loader",
options: {
Expand All @@ -44,17 +42,11 @@ module.exports = {
},
{
test: /\.css$/i,
//include: path.resolve(__dirname, 'src'),
exclude: "/node_modules/",
use: [MiniCssExtractPlugin.loader, "css-loader"],
},
{
test: /\.(png|jpe?g|gif|tsv)$/i,
use: [
{
loader: "file-loader",
},
],
type: "asset/resource",
},
{
test: /\.svg$/i,
Expand All @@ -78,6 +70,11 @@ module.exports = {
new HtmlWebpackPlugin({
template: "./src/popup.html",
filename: "popup.html",
chunks: ["popup"],
}),
new HtmlWebpackPlugin({
filename: "background.html",
chunks: ["background"],
}),
new CopyPlugin({
patterns: [{ from: "public" }],
Expand All @@ -92,4 +89,4 @@ module.exports = {
extensions: [".js", ".jsx"],
modules: ["node_modules", "src"],
},
};
};

0 comments on commit daf6797

Please sign in to comment.