chore(next): refactor nextjs config to mjs

remove husky
This commit is contained in:
xfy
2024-10-12 13:42:17 +08:00
parent 90da87d68e
commit f0b91cf14b
3 changed files with 9 additions and 13 deletions

View File

@ -1,5 +0,0 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
pnpm pretty-check
# pnpm lint

View File

@ -1,12 +1,13 @@
const withBundleAnalyzer = require('@next/bundle-analyzer')({ // import NextBundleAnalyzer from '@next/bundle-analyzer';
enabled: process.env.ANALYZE === 'true', //
}); // const withBundleAnalyzer = NextBundleAnalyzer({
// enabled: process.env.ANALYZE === 'true',
// });
/** /**
* @type {import('next').NextConfig} * @type {import('next').NextConfig}
*/ */
const nextConfig = { const nextConfig = {
/* config options here */
reactStrictMode: true, reactStrictMode: true,
swcMinify: true, swcMinify: true,
output: 'standalone', output: 'standalone',
@ -71,8 +72,9 @@ const KEYS_TO_OMIT = [
'assetPrefix', 'assetPrefix',
]; ];
module.exports = (_phase, { defaultConfig }) => { export default function finalConfig(_phase, { defaultConfig }) {
const plugins = [[withBundleAnalyzer, {}]]; // const plugins = [[withBundleAnalyzer, {}]];
const plugins = [[(config) => config, {}]];
const wConfig = plugins.reduce( const wConfig = plugins.reduce(
(acc, [plugin, config]) => plugin({ ...acc, ...config }), (acc, [plugin, config]) => plugin({ ...acc, ...config }),
@ -90,4 +92,4 @@ module.exports = (_phase, { defaultConfig }) => {
}); });
return finalConfig; return finalConfig;
}; }

View File

@ -59,7 +59,6 @@
"eslint-config-next": "14.2.7", "eslint-config-next": "14.2.7",
"file-loader": "^6.2.0", "file-loader": "^6.2.0",
"gray-matter": "^4.0.3", "gray-matter": "^4.0.3",
"husky": "^9.1.6",
"leva": "^0.9.35", "leva": "^0.9.35",
"postcss": "^8.4.47", "postcss": "^8.4.47",
"prettier": "^3.3.3", "prettier": "^3.3.3",