@@ -104,7 +135,7 @@ The function accepts one argument, an options object with the following properti
#### Example
```js
-const { createContentCollectionPlugin } = require("@content-collections/next");
+import { createContentCollectionPlugin } from "@content-collections/next";
/** @type {import('next').NextConfig} */
const nextConfig = {
@@ -115,7 +146,7 @@ const withPlugin = createContentCollectionPlugin({
configPath: "./config/content-collections.config.ts",
});
-module.exports = withPlugin(nextConfig);
+export default withPlugin(nextConfig);
```
### `withContentCollections`
@@ -125,12 +156,12 @@ The function takes a single argument, a Next.js configuration object, and return
#### Example
```js
-const { withContentCollections } = require("@content-collections/next");
+import { withContentCollections } from "@content-collections/next";
/** @type {import('next').NextConfig} */
const nextConfig = {
// your next.js config
};
-module.exports = withContentCollections(nextConfig);
+export default withContentCollections(nextConfig);
```
diff --git a/docs/quickstart/next.mdx b/docs/quickstart/next.mdx
index f88c39f7..61e0f193 100644
--- a/docs/quickstart/next.mdx
+++ b/docs/quickstart/next.mdx
@@ -42,7 +42,23 @@ This is necessary because we will generate the files in the `.content-collection
-Modify your `next.config.js`:
+Modify your Next.js configuration:
+
+
+
+
+```js
+import { withContentCollections } from "@content-collections/next";
+
+/** @type {import('next').NextConfig} */
+const nextConfig = {
+ // your next.js config
+};
+
+export default withContentCollections(nextConfig);
+```
+
+
```js
const { withContentCollections } = require("@content-collections/next");
@@ -54,6 +70,21 @@ const nextConfig = {
module.exports = withContentCollections(nextConfig);
```
+
+
+
+```ts
+import type { NextConfig } from "next";
+import { withContentCollections } from "@content-collections/next";
+
+const nextConfig: NextConfig = {
+ /* config options here */
+};
+
+export default withContentCollections(nextConfig);
+```
+
+
This will add content collections to the build of your next.js app.
For more details on the Next.js adapter, refer to the [documentation](/docs/adapter/next).