Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: create separate webpack #1592

Merged
merged 24 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
70079f1
Merge branch 'main' of github.com:juspay/hyperswitch-control-center
JeevaRamu0104 Sep 18, 2024
780a799
Merge branch 'main' of github.com:juspay/hyperswitch-control-center
JeevaRamu0104 Sep 19, 2024
24ac760
Merge branch 'main' of github.com:juspay/hyperswitch-control-center
JeevaRamu0104 Sep 24, 2024
2883deb
Merge branch 'main' of github.com:juspay/hyperswitch-control-center
JeevaRamu0104 Sep 25, 2024
047c6c5
Merge branch 'main' of github.com:juspay/hyperswitch-control-center
JeevaRamu0104 Sep 25, 2024
0365e91
Merge branch 'main' of github.com:juspay/hyperswitch-control-center
JeevaRamu0104 Sep 25, 2024
5eeb7af
Merge branch 'main' of github.com:juspay/hyperswitch-control-center
JeevaRamu0104 Sep 26, 2024
7ff97cf
Merge branch 'main' of github.com:juspay/hyperswitch-control-center
JeevaRamu0104 Sep 27, 2024
b594e3f
Merge branch 'main' of github.com:juspay/hyperswitch-control-center
JeevaRamu0104 Oct 1, 2024
639886c
Merge branch 'main' of github.com:juspay/hyperswitch-control-center
JeevaRamu0104 Oct 1, 2024
8c4fb4e
Merge branch 'main' of github.com:juspay/hyperswitch-control-center
JeevaRamu0104 Oct 1, 2024
789553d
Merge branch 'main' of github.com:juspay/hyperswitch-control-center
JeevaRamu0104 Oct 2, 2024
451a667
Merge branch 'main' of github.com:juspay/hyperswitch-control-center
JeevaRamu0104 Oct 3, 2024
6bff9ac
Merge branch 'main' of github.com:juspay/hyperswitch-control-center
JeevaRamu0104 Oct 4, 2024
cecb863
Merge branch 'main' of github.com:juspay/hyperswitch-control-center
JeevaRamu0104 Oct 9, 2024
5d9f00f
Merge branch 'main' of github.com:juspay/hyperswitch-control-center
JeevaRamu0104 Oct 10, 2024
6909aca
Merge branch 'main' of github.com:juspay/hyperswitch-control-center
JeevaRamu0104 Oct 11, 2024
e0e161a
chore: add custom-webpack
JeevaRamu0104 Oct 11, 2024
716f5a3
chore: add custom-webpack
JeevaRamu0104 Oct 15, 2024
70e10e5
Merge branch 'main' into create-seperate-webpack
JeevaRamu0104 Oct 15, 2024
a55cd11
Merge branch 'main' into create-seperate-webpack
JeevaRamu0104 Oct 15, 2024
e25a131
chore: add custom-webpack
JeevaRamu0104 Oct 15, 2024
7e29d3b
Merge branch 'create-seperate-webpack' of github.com:juspay/hyperswit…
JeevaRamu0104 Oct 15, 2024
ca468c0
Merge branch 'main' into create-seperate-webpack
JeevaRamu0104 Oct 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"serve": "node dist/server/server.js",
"prod:start": "webpack serve --config webpack.dev.js",
"build:netlify": "webpack --config webpack.prod.js --env netlifyHosted",
"build:custom": "npm run re:clean && npm run re:build && APP_VERSION=$npm_package_version && webpack --config webpack.custom.js",
"build:prod": "npm run re:clean && npm run re:build && APP_VERSION=$npm_package_version && webpack --config webpack.prod.js",
"build:test": "npm run re:clean && npm run re:build && APP_VERSION=$npm_package_version && webpack --config webpack.prod.js",
"re:build": "rescript",
Expand Down
90 changes: 90 additions & 0 deletions webpack.custom.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
const ReactRefreshWebpackPlugin = require("@pmmmwh/react-refresh-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const TerserPlugin = require("terser-webpack-plugin");
const CopyPlugin = require("copy-webpack-plugin");
const tailwindcss = require("tailwindcss");
const webpack = require("webpack");
const path = require("path");
const serverConfig = require("./webpack.server");
let customBuild = (appName = "hyperswitch") => {
const isDevelopment = process.env.NODE_ENV !== "production";
let entryObj = {
app: `./src/entryPoints/HyperSwitchEntry.res.js`,
};
return {
mode: "production",
entry: entryObj,
output: {
path: path.resolve(__dirname, "dist", appName),
clean: true,
publicPath: "/",
},
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
terserOptions: {
compress: {
drop_console: true,
},
},
}),
],
},
module: {
rules: [
{
test: /\.css$/i,
use: [
MiniCssExtractPlugin.loader,
"css-loader",
{
loader: "postcss-loader",
options: {
postcssOptions: {
plugins: [[tailwindcss("./tailwind.config.js")]],
},
},
},
],
},
{
test: /\.ttf$/,
use: ["file-loader"],
},
{
test: /\.js$/,
use: {
loader: "istanbul-instrumenter-loader",
options: { esModules: true },
},
enforce: "post",
exclude: /node_modules|\.spec\.js$/,
},
],
},
plugins: [
new MiniCssExtractPlugin(),
new CopyPlugin({
patterns: [
{ from: `public/${appName}/index.html` },
{ from: `public/${appName}/module.js` },
].filter(Boolean),
}),
new webpack.DefinePlugin({
dashboardAppName: JSON.stringify(appName),
dashboardAppEnv: JSON.stringify(process.env.APP_ENV || "sandbox"),
GIT_COMMIT_HASH: JSON.stringify(process.env.GIT_COMMIT_HASH || ""),
appVersion: JSON.stringify(process.env.APP_VERSION || ""),
}),
isDevelopment && new ReactRefreshWebpackPlugin(),
].filter(Boolean),
};
};

module.exports = (env, _argv) => {
var webpackConfigs = [serverConfig];
webpackConfigs.push(customBuild("hyperswitch", env));
console.log("webpackConfigs", webpackConfigs);
return webpackConfigs;
};
Loading