aboutsummaryrefslogtreecommitdiffstats
path: root/next.config.js
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2023-09-25 15:24:06 +0200
committerArmand Philippot <git@armandphilippot.com>2023-10-24 12:23:48 +0200
commita22214f2a2efcdac2666e1aad3332cb49d2f2198 (patch)
treea1f9c6a20ca5d5fa81c998b8a53974be310a0d02 /next.config.js
parenta6ff5eee45215effb3344cb5d631a27a7c0369aa (diff)
build: convert project to esm
Diffstat (limited to 'next.config.js')
-rw-r--r--next.config.js17
1 files changed, 11 insertions, 6 deletions
diff --git a/next.config.js b/next.config.js
index 27f3e6a..04802f1 100644
--- a/next.config.js
+++ b/next.config.js
@@ -1,4 +1,9 @@
-const path = require('path');
+import { dirname, join } from 'node:path';
+import { fileURLToPath } from 'node:url';
+import bundleAnalyzer from '@next/bundle-analyzer';
+import nextMDX from '@next/mdx';
+
+const currentDir = dirname(fileURLToPath(import.meta.url));
const isStaging = process.env.NEXT_PUBLIC_APP_ENV === 'staging';
const backendDomain = isStaging
@@ -106,8 +111,8 @@ const nextConfig = {
},
sassOptions: {
includePaths: [
- path.join(__dirname, 'styles'),
- path.join(__dirname, 'node_modules'),
+ join(currentDir, 'styles'),
+ join(currentDir, 'node_modules'),
],
},
webpack: (config) => {
@@ -146,11 +151,11 @@ const nextConfig = {
},
};
-const withBundleAnalyzer = require('@next/bundle-analyzer')({
+const withBundleAnalyzer = bundleAnalyzer({
enabled: process.env.ANALYZE === 'true',
});
-const withMDX = require('@next/mdx')({
+const withMDX = nextMDX({
extension: /\.mdx?$/,
options: {
remarkPlugins: [],
@@ -158,4 +163,4 @@ const withMDX = require('@next/mdx')({
},
});
-module.exports = withBundleAnalyzer(withMDX(nextConfig));
+export default withBundleAnalyzer(withMDX(nextConfig));