File: /var/www/quadcode/frontend/webpack.constants.js
const path = require("path");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const StringReplacePlugin = require("string-replace-webpack-plugin");
const PATHS = {
src: path.join(__dirname, "./src"),
dist: path.join(__dirname, "./dist"),
distLp: path.join(__dirname, "./dist/lp"),
};
const lpArray = [
"white-label-cfd-broker.html",
"saas-landing.html",
"affiliate.html",
"affiliate_traffic.html",
"affiliate_broker.html",
"saas_request.html",
"wl-broker_landing.html",
"white-label-brokerage.html",
"digital-currency-brokerage.html",
"free-brokerage.html",
"white-label.html",
];
const excludeChunks = (pageName) => {
switch (pageName) {
case "numbers.html":
return [
"ifx",
"saas",
"news",
"saas_request",
"affiliate",
"affiliate_broker",
"affiliate_traffic",
"whiteLabel",
"white_label_brokerage",
];
case "news.html":
case "news-banking.html":
case "news-brokerage.html":
case "news-holding.html":
case "news-saas.html":
case "news-1.html":
case "news-2.html":
case "news-3.html":
case "news-4.html":
case "news-5.html":
case "news-6.html":
case "news-7.html":
case "news-8.html":
return [
"ifx",
"saas",
"main",
"schedule",
"saas_request",
"affiliate",
"affiliate_broker",
"affiliate_traffic",
"whiteLabel",
"white_label_brokerage",
"digital-currency-brokerage",
"freeBrokerage",
];
case "saas-landing.html":
case "wl-broker_landing.html":
case "white-label.html":
return [
"main",
"ifx",
"schedule",
"news",
"saas_request",
"affiliate",
"affiliate_broker",
"affiliate_traffic",
"whiteLabel",
"white_label_brokerage",
"digital-currency-brokerage",
"freeBrokerage",
];
case "affiliate.html":
return [
"main",
"ifx",
"schedule",
"news",
"saas_request",
"saas",
"whiteLabel",
"affiliate_traffic",
"affiliate_broker",
"white_label_brokerage",
"digital-currency-brokerage",
"freeBrokerage",
];
case "affiliate_traffic.html":
return [
"main",
"ifx",
"schedule",
"news",
"saas_request",
"saas",
"whiteLabel",
"affiliate",
"affiliate_broker",
"white_label_brokerage",
"digital-currency-brokerage",
"freeBrokerage",
];
case "affiliate_broker.html":
return [
"main",
"ifx",
"schedule",
"news",
"saas_request",
"saas",
"whiteLabel",
"affiliate",
"affiliate_traffic",
"white_label_brokerage",
"digital-currency-brokerage",
"freeBrokerage",
];
case "white-label-brokerage.html":
return [
"main",
"ifx",
"schedule",
"news",
"saas_request",
"saas",
"whiteLabel",
"affiliate",
"affiliate_traffic",
"affiliate_broker",
"digital-currency-brokerage",
"freeBrokerage",
];
case "digital-currency-brokerage.html":
return [
"main",
"ifx",
"schedule",
"news",
"saas_request",
"saas",
"whiteLabel",
"affiliate",
"affiliate_traffic",
"affiliate_broker",
"white_label_brokerage",
"freeBrokerage",
];
case "saas_request.html":
return [
"main",
"ifx",
"schedule",
"news",
"saas",
"affiliate",
"affiliate_broker",
"affiliate_traffic",
"whiteLabel",
"white_label_brokerage",
"digital-currency-brokerage",
"freeBrokerage",
];
case "white-label-cfd-broker.html":
return [
"main",
"ifx",
"schedule",
"news",
"saas",
"saas_request",
"affiliate",
"affiliate_broker",
"affiliate_traffic",
"white_label_brokerage",
"digital-currency-brokerage",
"freeBrokerage",
];
case "free-brokerage.html":
return [
"main",
"ifx",
"schedule",
"news",
"saas",
"saas_request",
"affiliate",
"affiliate_broker",
"affiliate_traffic",
"whiteLabel",
"white_label_brokerage",
"digital-currency-brokerage",
];
default:
return [
"schedule",
"ifx",
"saas",
"news",
"saas_request",
"affiliate",
"affiliate_traffic",
"affiliate_broker",
"whiteLabel",
"white_label_brokerage",
"digital-currency-brokerage",
"freeBrokerage",
];
}
};
const renderPage = (page) => {
switch (page) {
case "white-label-cfd-broker.html":
return "./white-label-cfd-broker.html";
case "saas-landing.html":
return "./saas.html";
case "affiliate.html":
return "./affiliate.html";
case "affiliate_traffic.html":
return "./affiliate_traffic.html";
case "affiliate_broker.html":
return "./affiliate_broker.html";
case "white-label-brokerage.html":
return "./white-label-brokerage.html";
case "digital-currency-brokerage.html":
return "./digital-currency-brokerage.html";
case "saas_request.html":
return "./saas_request.html";
case "wl-broker_landing.html":
return "./wl-broker.html";
case "white-label.html":
return "./white-label.html";
case "free-brokerage.html":
return "./free-brokerage/index.html";
case "news-banking.html":
return "./news/banking.html";
case "news-brokerage.html":
return "./news/brokerage.html";
case "news-holding.html":
return "./news/holding.html";
case "news-saas.html":
return "./news/saas.html";
case "news-1.html":
return "./news/quadcode-saas-receives-uf-award-for-best-all-in-on-broke.html";
case "news-2.html":
return "./news/quadcode-saas-debuts-at-ifx-expo.html";
case "news-3.html":
return "./news/quadcode-partners-with-pavlos-kontides-to-support-young-sailing-athletes.html";
default:
return `./${page}`;
}
};
const getCommonRules = () => [
{
test: /\.js$/,
exclude: /node_modules/,
use: ["babel-loader"],
},
{
test: /\.(?:ico|gif|png|jpg|jpeg|svg|mp4|webp)$/i,
type: "asset/resource",
generator: {
filename: "assets/[hash][ext][query]",
},
},
{
test: /\.(woff(2)?|eot|ttf|otf|)$/,
type: "asset/resource",
generator: {
filename: "assets/fonts/[hash][ext][query]",
},
},
{
test: /\.(scss|css)$/,
use: [
MiniCssExtractPlugin.loader,
"css-loader",
"postcss-loader",
"sass-loader",
],
},
{
test: /\.(js)$/,
exclude: /node_modules/,
use: StringReplacePlugin.replace({
replacements: [
{
pattern: /<!-- @secret (\w*?) -->/gi,
replacement: (match, p1) => process.env[p1] || "",
},
],
}),
},
];
module.exports = {
PATHS,
lpArray,
excludeChunks,
renderPage,
getCommonRules,
};