Skip to content

Commit

Permalink
use webp images instead of png and jpg
Browse files Browse the repository at this point in the history
  • Loading branch information
erinz2020 committed Dec 18, 2024
1 parent d0f087c commit 0e7d1e5
Show file tree
Hide file tree
Showing 9 changed files with 2,382 additions and 585 deletions.
56 changes: 26 additions & 30 deletions frontend/config-overrides.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,12 @@
// // config-overrides.js
// const webpack = require("webpack");
// module.exports = function override(config, env) {
// if (env === "production") {
// config.devtool = "source-map";
// // config.devtool = 'cheap-module-source-map';
// }
// config.plugins.push(
// new webpack.DefinePlugin({
// "process.env.SITE_NAME": JSON.stringify(process.env.SITE_NAME),
// }),
// );
// return config;
// };

const {
override,
addWebpackPlugin,
fixBabelImports,
} = require("customize-cra");
const webpack = require("webpack");
const BundleAnalyzerPlugin =
require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
// const CompressionPlugin = require("compression-webpack-plugin");
const TerserPlugin = require("terser-webpack-plugin");
const webpack = require("webpack");
// const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin;

module.exports = override(
fixBabelImports("import", {
Expand All @@ -30,10 +15,11 @@ module.exports = override(
style: "css",
}),

(config, env) => {
(config) => {
const env = process.env.NODE_ENV;
if (env === "production") {
console.log("Production build!");
config.devtool = "source-map";

config.optimization = {
...config.optimization,
minimize: true,
Expand All @@ -43,22 +29,32 @@ module.exports = override(
compress: {
drop_console: true,
drop_debugger: true,
unused: true,
},
output: {},
},
extractComments: false,
}),
],
};

config.plugins.push(
new webpack.IgnorePlugin({
resourceRegExp: /^\.\/locale$/,
contextRegExp: /moment$/,
}),
);
// config.plugins.push(
// new CompressionPlugin({
// filename: "[path][base].gz",
// algorithm: "gzip",
// test: /\.(js|css|html|svg)$/,
// threshold: 10240,
// minRatio: 0.8,
// deleteOriginalAssets: false,
// })
// );
}

config.stats = {
all: true,
timings: true,
assets: true,
chunks: true,
modules: true,
};

return config;
},

Expand All @@ -68,5 +64,5 @@ module.exports = override(
}),
),

addWebpackPlugin(new BundleAnalyzerPlugin()),
// addWebpackPlugin(new BundleAnalyzerPlugin()),
);
Loading

0 comments on commit 0e7d1e5

Please sign in to comment.