Skip to content

Commit c770c34

Browse files
committed
feat!: module exports
1 parent 6708b61 commit c770c34

File tree

3 files changed

+2558
-2656
lines changed

3 files changed

+2558
-2656
lines changed

package.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,14 @@
44
"description": "",
55
"repository": "nuxt-community/nuxt-extend",
66
"license": "MIT",
7+
"exports": {
8+
".": {
9+
"import": "./dist/index.mjs",
10+
"require": "./dist/index.js"
11+
}
12+
},
713
"main": "./dist/index.js",
14+
"module": "./dist/index.mjs",
815
"types": "./dist/index.d.ts",
916
"files": [
1017
"dist"
@@ -19,7 +26,7 @@
1926
"test": "yarn lint && yarn jest"
2027
},
2128
"dependencies": {
22-
"defu": "^3.2.2",
29+
"defu": "^4.0.1",
2330
"hookable": "^4.4.1",
2431
"jiti": "^1.9.1"
2532
},

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,11 @@ function normalizeComponents (components: NuxtConfig['components'], isBase?: boo
9898
throw new TypeError('`components` should be an array: ' + typeof components)
9999
}
100100

101-
components = components.map(dir => ({
101+
const componentsArr = components.map(dir => ({
102102
...(typeof dir === 'string' ? { path: dir } : dir)
103103
}))
104104

105-
for (const component of components) {
105+
for (const component of componentsArr) {
106106
component.level = (component.level || 0) + (isBase ? 1 : 0)
107107
}
108108

0 commit comments

Comments
 (0)