Skip to content

Commit 1b74126

Browse files
committed
chore: enhance Next.js configuration and update dependencies
- Refactor next.config.js to simplify configuration and add support for trailing slashes and package transpilation. - Introduce cross-env for setting environment variables in the build script. - Update TypeScript target to ES2017 and change module resolution to bundler. - Add cross-env as a new dependency in package.json and package-lock.json.
1 parent 92b1766 commit 1b74126

File tree

4 files changed

+52
-25
lines changed

4 files changed

+52
-25
lines changed

next.config.js

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
/** @type {import('next').NextConfig} */
22

3-
const exp = require('constants')
4-
const { PHASE_PRODUCTION_BUILD } = require('next/dist/shared/lib/constants')
5-
6-
const nextConfig = (phase) => {
7-
const isProduction = phase === PHASE_PRODUCTION_BUILD
8-
9-
return {
10-
output: 'export',
11-
// basePath: '/expressots-site',
12-
images: { unoptimized: true },
13-
assetPrefix: isProduction ? 'https://expresso-ts.com' : '',
14-
}
3+
const nextConfig = {
4+
output: 'export',
5+
images: { unoptimized: true },
6+
trailingSlash: true,
7+
transpilePackages: ['@tabler/icons-react'],
8+
webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => {
9+
// Fix for module resolution
10+
config.resolve.fallback = {
11+
...config.resolve.fallback,
12+
fs: false,
13+
}
14+
return config
15+
},
1516
}
1617

1718
module.exports = nextConfig

package-lock.json

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"private": true,
66
"scripts": {
77
"dev": "next dev --turbopack",
8-
"build": "NODE_ENV=production next build",
8+
"build": "cross-env NODE_ENV=production next build",
99
"build:v2": "next build",
1010
"export": "next export",
1111
"prod": "npx serve@latest out",
@@ -14,17 +14,17 @@
1414
"format": "prettier --write ."
1515
},
1616
"dependencies": {
17-
"next": "15.4.2",
18-
"react": "^18.3.1",
19-
"react-dom": "^18.3.1",
2017
"@headlessui/react": "^2.2.4",
2118
"@radix-ui/react-icons": "^1.3.2",
2219
"@radix-ui/react-navigation-menu": "^1.2.1",
2320
"@radix-ui/react-tooltip": "^1.1.3",
24-
"@tabler/icons-react": "^3.30.0",
2521
"@stackblitz/sdk": "^1.11.0",
22+
"@tabler/icons-react": "^3.30.0",
2623
"@uidotdev/usehooks": "^2.4.0",
2724
"clsx": "^2.1.1",
25+
"next": "15.4.2",
26+
"react": "^18.3.1",
27+
"react-dom": "^18.3.1",
2828
"scrollen": "^0.0.2",
2929
"tailwind-merge": "^2.5.2"
3030
},
@@ -33,10 +33,8 @@
3333
"@types/react": "^18.3.12",
3434
"@types/react-dom": "^18.3.1",
3535
"@typescript-eslint/eslint-plugin": "^8.24.1",
36-
"typescript": "^5.6.3",
37-
"tailwindcss": "^3.4.14",
3836
"autoprefixer": "^10.4.20",
39-
"postcss": "^8.4.41",
37+
"cross-env": "^7.0.3",
4038
"eslint": "^8.57.0",
4139
"eslint-config-next": "^15.1.7",
4240
"eslint-config-prettier": "^9.1.0",
@@ -47,8 +45,11 @@
4745
"eslint-plugin-prettier": "^5.0.1",
4846
"eslint-plugin-promise": "^6.1.1",
4947
"eslint-plugin-react": "^7.32.2",
50-
"eslint-plugin-react-hooks": "^4.6.2",
48+
"eslint-plugin-react-hooks": "^5.0.0",
49+
"postcss": "^8.4.41",
5150
"prettier": "^3.5.1",
52-
"prettier-plugin-tailwindcss": "^0.6.6"
51+
"prettier-plugin-tailwindcss": "^0.6.6",
52+
"tailwindcss": "^3.4.14",
53+
"typescript": "^5.6.3"
5354
}
5455
}

tsconfig.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"compilerOptions": {
3-
"target": "es5",
3+
"target": "ES2017",
44
"lib": ["dom", "dom.iterable", "esnext"],
55
"allowJs": true,
66
"skipLibCheck": true,
@@ -9,7 +9,7 @@
99
"noEmit": true,
1010
"esModuleInterop": true,
1111
"module": "esnext",
12-
"moduleResolution": "node",
12+
"moduleResolution": "bundler",
1313
"resolveJsonModule": true,
1414
"isolatedModules": true,
1515
"jsx": "preserve",
@@ -23,6 +23,11 @@
2323
"@/*": ["./src/*"]
2424
}
2525
},
26-
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
26+
"include": [
27+
"next-env.d.ts",
28+
"**/*.ts",
29+
"**/*.tsx",
30+
".next/types/**/*.ts"
31+
],
2732
"exclude": ["node_modules"]
2833
}

0 commit comments

Comments
 (0)