Skip to content

Commit 6095424

Browse files
docs: review nextjs plugin (#453)
Signed-off-by: David Dal Busco <david.dalbusco@outlook.com>
1 parent a603253 commit 6095424

1 file changed

Lines changed: 19 additions & 32 deletions

File tree

docs/reference/plugins.mdx

Lines changed: 19 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,13 @@ keywords:
1515

1616
# Plugins
1717

18-
Juno provides various plugins to simplify your development workflow. We also warmly welcome community contributions. If you would like to create or submit plugins or any libraries, please reach out or explore our [repository](https://github.com/junobuild/plugins)!
18+
Juno provides various plugins to simplify your development workflow. Each plugin automatically loads values from your `juno.config` file into your build environment, so you can call `initSatellite()` and `initOrbiter()` without extra config.
1919

2020
---
2121

2222
## Next.js Plugin
2323

24-
If you are developing your app using Next.js, this plugin automatically loads Satellite and Orbiter IDs from your project's configuration file.
25-
26-
These values allow you to instantiate Juno in your code without the need to manually define environment variables.
27-
28-
```javascript
29-
// Initialize the Satellite using values from juno.config
30-
await initSatellite();
31-
32-
// Initialize analytics using values from juno.config
33-
initOrbiter();
34-
```
24+
Use this plugin to load Juno configuration into your Next.js build with zero manual setup.
3525

3626
### Installation
3727

@@ -52,25 +42,36 @@ In your Next.js config file — whether it's `next.config.js`, `next.config.ts`,
5242
```javascript title="next.config.js"
5343
import { withJuno } from "@junobuild/nextjs-plugin";
5444

45+
// withJuno wraps your Next.js config and injects values from juno.config
5546
export default withJuno();
5647
```
5748

5849
### Options
5950

60-
The plugin supports following options:
51+
The plugin supports the following options:
6152

6253
#### Passing Next.js Options
6354

64-
The plugin sets the build output to `export` by default. You can provide additional options as follows:
55+
You can pass additional Next.js configuration options using the `nextConfig` field.
56+
57+
The plugin will always ensure `output: "export"` is set for static export.
6558

6659
```javascript title="next.config.js"
6760
import { withJuno } from "@junobuild/nextjs-plugin";
6861

6962
/** @type {import('next').NextConfig} */
7063
const nextConfig = {
71-
output: "export"
64+
// Example: add your own Next.js config here
65+
i18n: {
66+
locales: ["en", "fr"],
67+
defaultLocale: "en"
68+
},
69+
env: {
70+
CUSTOM_VAR: "my-value"
71+
}
7272
};
7373

74+
// Juno will merge this with output: "export" automatically
7475
export default withJuno({ nextConfig });
7576
```
7677

@@ -86,12 +87,7 @@ You can use the `container` option to:
8687
```javascript title="next.config.js"
8788
import { withJuno } from "@junobuild/nextjs-plugin";
8889

89-
/** @type {import('next').NextConfig} */
90-
const nextConfig = {
91-
output: "export"
92-
};
93-
94-
export default withJuno({ nextConfig, juno: { container: false } });
90+
export default withJuno({ juno: { container: false } });
9591
```
9692

9793
### Environment Variables
@@ -110,17 +106,7 @@ Discover additional information in the library's [README](https://github.com/jun
110106

111107
## Vite Plugin
112108

113-
If you are developing your app using Vite, this plugin automatically loads the Satellite ID from your project's configuration file. If you are using analytics, it also loads the Orbiter ID too.
114-
115-
These values allow you to instantiate Juno in your code without the need to manually define environment variables.
116-
117-
```javascript
118-
// Initialize the Satellite using values from juno.config
119-
await initSatellite();
120-
121-
// Initialize analytics using values from juno.config
122-
initOrbiter();
123-
```
109+
Use this plugin to integrate Juno configuration into your Vite build process automatically.
124110

125111
### Installation
126112

@@ -140,6 +126,7 @@ Add the plugin to your Vite configuration — whether you're using TypeScript or
140126
import juno from "@junobuild/vite-plugin";
141127

142128
export default defineConfig({
129+
// Automatically injects values from juno.config for the build
143130
plugins: [juno()]
144131
});
145132
```

0 commit comments

Comments
 (0)