From f0b91cf14bddcc782fba9cac5a2df8d5b32911a6 Mon Sep 17 00:00:00 2001 From: xfy Date: Sat, 12 Oct 2024 13:42:17 +0800 Subject: [PATCH] chore(next): refactor nextjs config to mjs remove husky --- .husky/pre-commit | 5 ----- next.config.js => next.config.mjs | 16 +++++++++------- package.json | 1 - 3 files changed, 9 insertions(+), 13 deletions(-) delete mode 100755 .husky/pre-commit rename next.config.js => next.config.mjs (85%) diff --git a/.husky/pre-commit b/.husky/pre-commit deleted file mode 100755 index 8b13de6..0000000 --- a/.husky/pre-commit +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env sh -. "$(dirname -- "$0")/_/husky.sh" - -pnpm pretty-check -# pnpm lint diff --git a/next.config.js b/next.config.mjs similarity index 85% rename from next.config.js rename to next.config.mjs index bc624f2..35d8289 100644 --- a/next.config.js +++ b/next.config.mjs @@ -1,12 +1,13 @@ -const withBundleAnalyzer = require('@next/bundle-analyzer')({ - enabled: process.env.ANALYZE === 'true', -}); +// import NextBundleAnalyzer from '@next/bundle-analyzer'; +// +// const withBundleAnalyzer = NextBundleAnalyzer({ +// enabled: process.env.ANALYZE === 'true', +// }); /** * @type {import('next').NextConfig} */ const nextConfig = { - /* config options here */ reactStrictMode: true, swcMinify: true, output: 'standalone', @@ -71,8 +72,9 @@ const KEYS_TO_OMIT = [ 'assetPrefix', ]; -module.exports = (_phase, { defaultConfig }) => { - const plugins = [[withBundleAnalyzer, {}]]; +export default function finalConfig(_phase, { defaultConfig }) { + // const plugins = [[withBundleAnalyzer, {}]]; + const plugins = [[(config) => config, {}]]; const wConfig = plugins.reduce( (acc, [plugin, config]) => plugin({ ...acc, ...config }), @@ -90,4 +92,4 @@ module.exports = (_phase, { defaultConfig }) => { }); return finalConfig; -}; +} diff --git a/package.json b/package.json index 3865eef..8cb0adf 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,6 @@ "eslint-config-next": "14.2.7", "file-loader": "^6.2.0", "gray-matter": "^4.0.3", - "husky": "^9.1.6", "leva": "^0.9.35", "postcss": "^8.4.47", "prettier": "^3.3.3",