Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

fix contentlayer build errors (#26822)

Francesco Sansalvadoreb88adfef4684
diff --git a/apps/www/internals/fix-contentlayer-bug.mjs b/apps/www/internals/fix-contentlayer-bug.mjs
new file mode 100644
index 00000000000..eab38b1934c
--- /dev/null
+++ b/apps/www/internals/fix-contentlayer-bug.mjs
@@ -0,0 +1,29 @@
+import fs from 'fs'
+import path from 'path'
+
+// Path to the package within the global node_modules
+const packagePath = path.resolve(process.cwd(), '../../node_modules/@contentlayer2')
+
+// Path to the specific file you want to modify
+const filePath = path.join(packagePath, 'core', 'dist', 'getConfig', 'index.js')
+
+// Read the file
+fs.readFile(filePath, 'utf8', (err, data) => {
+ if (err) {
+ console.error(`Error reading file: ${err}`)
+ return
+ }
+
+ // Modify the file content
+ let modifiedContent = data.replace('../../../../', '../../../')
+
+ // Write the modified content back to the file
+ fs.writeFile(filePath, modifiedContent, 'utf8', (err) => {
+ if (err) {
+ console.error(`Error writing file: ${err}`)
+ return
+ }
+
+ console.log('fix-contentlayer-bug was successfull')
+ })
+})
diff --git a/apps/www/package.json b/apps/www/package.json
index bb5dae5bfb2..3a2134d0db5 100644
--- a/apps/www/package.json
+++ b/apps/www/package.json
@@ -11,7 +11,7 @@
"typecheck": "npm run content:build && tsc --noEmit",
"content:build": "contentlayer2 build",
"prettier": "prettier --write \"./{pages,components,lib,stores,styles,tests}/**/*.{ts,tsx,md,js,jsx,json}\"",
- "postbuild": "node ./internals/generate-sitemap.mjs"
+ "postbuild": "node ./internals/fix-contentlayer-bug.mjs && node ./internals/generate-sitemap.mjs"
},
"dependencies": {
"@code-hike/mdx": "^0.9.0",
@@ -33,7 +33,7 @@
"cobe": "^0.6.2",
"common": "*",
"config": "*",
- "contentlayer2": "0.4.5",
+ "contentlayer2": "^0.4.5",
"dat.gui": "^0.7.9",
"dayjs": "^1.11.10",
"framer-motion": "^11.0.3",