Skip to content

Commit 6b30cde

Browse files
committed
docs: update to latest recommendations
1 parent 48e98e5 commit 6b30cde

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

README.md

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,22 @@
1313
- Unified build with [unjs/unbuild](https://github.com/unjs/unbuild)
1414
- Automated build config using last module spec
1515
- Typescript and ESM support
16-
- Auto generated CommonJS stubs
1716
- Auto generated types and shims for `@nuxt/schema`
1817

1918
We recommend to checkout the [Nuxt modules author guide](https://nuxt.com/docs/guide/going-further/modules) before starting with the module-builder.
2019

2120
## Requirements
2221

2322
For a user to use a module generated from module-builder, it's recommended they have:
24-
- Node.js >= 16.x. _Latest Node LTS preferred_
25-
- Nuxt 3 or Nuxt Bridge. _Nuxt 2 is functional but not advised_
23+
- Node.js >= 18.x. _Latest Node LTS preferred_
24+
- Nuxt 3+.
2625

2726
## Quick start
2827

2928
Get started with our [module starter](https://github.com/nuxt/starter/tree/module):
3029

3130
```bash
32-
npx nuxi init -t module my-module
31+
npm create nuxt -- -t module my-module
3332
```
3433

3534
## Project structure
@@ -100,21 +99,26 @@ A minimum `package.json` should look like this:
10099
"version": "1.0.0",
101100
"exports": {
102101
".": {
103-
"types": "./dist/types.d.ts",
104-
"import": "./dist/module.mjs",
105-
"require": "./dist/module.cjs"
102+
"types": "./dist/types.d.mts",
103+
"import": "./dist/module.mjs"
104+
}
105+
},
106+
"main": "./dist/module.mjs",
107+
"typesVersions": {
108+
"*": {
109+
".": [
110+
"./dist/types.d.mts"
111+
]
106112
}
107113
},
108-
"main": "./dist/module.cjs",
109-
"types": "./dist/types.d.ts",
110114
"files": [
111115
"dist"
112116
],
113117
"scripts": {
114118
"prepack": "nuxt-module-build build"
115119
},
116120
"dependencies": {
117-
"@nuxt/kit": "npm:@nuxt/kit-edge@latest"
121+
"@nuxt/kit": "latest"
118122
},
119123
"devDependencies": {
120124
"@nuxt/module-builder": "latest"
@@ -142,8 +146,7 @@ Module builder generates dist files in `dist/` directory:
142146

143147
- `module.mjs`: Module entrypoint build from `src/module`
144148
- `module.json`: Module meta extracted from `module.mjs` + `package.json`
145-
- `module.cjs`: ESM proxy to allow require module in CommonJS context
146-
- `types.d.ts`: Exported types in addition to shims for `nuxt.config` auto completion.
149+
- `types.d.mts`: Exported types in addition to shims for `nuxt.config` auto completion.
147150
- `runtime/*`: Individually transformed files using [unjs/mkdist](https://github.com/unjs/mkdist)
148151
- Javascript and `.ts` files will be transformed to `.js` with extracted types on `.d.ts` file with same name
149152
- `.vue` files will be transformed with extracted `.d.ts` file

0 commit comments

Comments
 (0)