Skip to content

Commit 558199d

Browse files
wip(docs): add more details
1 parent b976f90 commit 558199d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/index.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,17 @@ interface Options {
8181
/**
8282
* Initial cache that will contain resolved dependencies. All new modules go here.
8383
* `vue` must initially be contained in this object.
84+
* [[moduleCache]] is mandatory for the lib but optional for you. If you do not provide it, the lib will automatically add it to the [[options]] object.
85+
* It is recommended to provide a prototype-less object (`Object.create(null)`) to avoid potential conflict with `Object` properties (constructor, __proto__, hasOwnProperty, ...).
86+
​ *
87+
* See also [[options.loadModule]].
8488
*
8589
* **example:**
8690
* ```javascript
8791
* ...
88-
* moduleCache: {
92+
* moduleCache: Object.assign(Object.create(null), {
8993
* vue: Vue,
90-
* },
94+
* }),
9195
* ...
9296
* ```
9397
*
@@ -217,6 +221,8 @@ interface Options {
217221
* @param options The options object.
218222
* @returns A Promise of the module or undefined
219223
*
224+
* [[moduleCache]] and [[Options.loadModule]] are strongly related, in the sense that the result of [[options.loadModule]] is stored in [[moduleCache]].
225+
* However, [[options.loadModule]] is asynchronous and may help you to handle modules or components that are conditionally required (optional features, current languages, plugins, ...).
220226
* ```javascript
221227
* ...
222228
* loadModule(path, options) {

0 commit comments

Comments
 (0)