Skip to content

Commit

Permalink
Simplify config
Browse files Browse the repository at this point in the history
  • Loading branch information
jackyef committed Mar 3, 2024
1 parent 4f443ef commit c1e5384
Show file tree
Hide file tree
Showing 3 changed files with 524 additions and 282 deletions.
30 changes: 2 additions & 28 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const { StatsWriterPlugin } = require('webpack-stats-plugin');
const { RelativeCiAgentWebpackPlugin } = require('@relative-ci/agent');
const withBundleStats = require('next-plugin-bundle-stats');
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true',
});
Expand All @@ -14,31 +13,6 @@ const conf = {
images: {
formats: ['image/avif', 'image/webp'],
},
webpack: function (config, options) {
const { dev, isServer } = options;

if (!dev && !isServer) {
config.plugins.push(
new RelativeCiAgentWebpackPlugin({
stats: { excludeAssets: [/stats.json/] },
}),
);
config.plugins.push(
new StatsWriterPlugin({
filename: 'stats.json',
stats: {
context: './', // optional, will improve readability of the paths
assets: true,
entrypoints: true,
chunks: true,
modules: true,
},
}),
);
}

return config;
},
};

module.exports = flowRight(withBundleAnalyzer)(conf);
module.exports = flowRight(withBundleAnalyzer, withBundleStats)(conf);
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"@jsdevtools/rehype-toc": "^3.0.2",
"@mapbox/rehype-prism": "^0.5.0",
"@next/eslint-plugin-next": "^12.0.1",
"@relative-ci/agent": "^4.2.5",
"@tailwindcss/aspect-ratio": "^0.4.0",
"@tailwindcss/forms": "^0.5.0",
"@tailwindcss/line-clamp": "^0.3.1",
Expand All @@ -42,6 +41,7 @@
"eslint-plugin-react-hooks": "^2.3.0",
"globby": "^11.0.1",
"hastscript": "^6.0.0",
"next-plugin-bundle-stats": "^4.12.0",
"next-remote-watch": "^2.0.0",
"postcss": "^8.4.12",
"postcss-preset-env": "^7.0.1",
Expand All @@ -53,7 +53,6 @@
"tailwindcss": "^3.3.0",
"typescript": "^4.8.4",
"unist-util-visit": "^2.0.3",
"webpack-stats-plugin": "^1.1.3",
"xml-formatter": "^2.3.0"
},
"dependencies": {
Expand Down
Loading

0 comments on commit c1e5384

Please sign in to comment.