Skip to content

Commit d4106e9

Browse files
authored
Impove Next.js Tutorial (#2619)
1 parent acdcef7 commit d4106e9

File tree

1 file changed

+11
-25
lines changed

1 file changed

+11
-25
lines changed

examples/tutorials/next.md

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -47,45 +47,31 @@ compatibility, update your `deno.json` file with the following configuration:
4747

4848
```json deno.json
4949
{
50-
"nodeModulesDir": "auto",
5150
"unstable": [
51+
"bare-node-builtins",
52+
"detect-cjs",
53+
"node-globals",
5254
"unsafe-proto",
5355
"sloppy-imports"
54-
],
55-
"compilerOptions": {
56-
"lib": [
57-
"dom",
58-
"dom.iterable",
59-
"esnext"
60-
],
61-
"strict": true,
62-
"jsx": "preserve"
63-
},
64-
"tasks": {
65-
"dev": "deno run -A --unstable-detect-cjs npm:next@latest dev",
66-
"build": "deno run -A --unstable-detect-cjs npm:next@latest build",
67-
"start": "deno run -A --unstable-detect-cjs npm:next@latest start"
68-
}
56+
]
6957
}
7058
```
7159

72-
This configuration includes:
60+
Now install the dependencies found in the package.json:
7361

74-
- `nodeModulesDir: "auto"` - Enables npm package lifecycle scripts
75-
- `unstable: ["unsafe-proto", "sloppy-imports"]` - Required for Next.js
76-
compatibility
77-
- `--unstable-detect-cjs` flag - Enables CommonJS module detection for Next.js
78-
dependencies
62+
```sh
63+
deno install --allow-scripts
64+
```
7965

8066
Now you can serve your new Next.js app:
8167

8268
```sh
83-
deno run dev
69+
deno task dev
8470
```
8571

8672
This will start the Next.js development server using Deno. The `deno task dev`
87-
command runs the Next.js development server with the necessary flags for
88-
CommonJS compatibility.
73+
command runs `dev` task in the package.json, which starts the Next.js
74+
development server with the necessary flags for CommonJS compatibility.
8975

9076
Visit [http://localhost:3000](http://localhost:3000) to see the app in the
9177
browser.

0 commit comments

Comments
 (0)