You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*Defined in [index.ts:750](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/547328e/src/index.ts#L750)*
54
+
*Defined in [index.ts:759](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/c0792ec/src/index.ts#L759)*
55
55
56
56
This is the main function.
57
57
@@ -62,7 +62,7 @@ Name | Type | Default value | Description |
62
62
`path` | string | - | The path of the `.vue` file. If path is not a path (eg. an string ID), your [getFile](interfaces/options.md#getfile) function must return a [File](README.md#file) object. |
63
63
`options` | [Options](interfaces/options.md) | throwNotDefined('options') | The options |
*Defined in [index.ts:153](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/547328e/src/index.ts#L153)*
48
+
*Defined in [index.ts:160](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/c0792ec/src/index.ts#L160)*
49
49
50
50
Additional module type handlers. see [ModuleHandler](modulehandler.md)
51
51
@@ -55,7 +55,7 @@ ___
55
55
56
56
• `Optional`**compiledCache**: [Cache](cache.md)
57
57
58
-
*Defined in [index.ts:193](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/547328e/src/index.ts#L193)*
58
+
*Defined in [index.ts:200](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/c0792ec/src/index.ts#L200)*
59
59
60
60
[get](cache.md#get)() and [set](cache.md#set)() functions of this object are called when the lib needs to save or load already compiled code. get and set functions must return a `Promise` (or can be `async`).
61
61
Since compilation consume a lot of CPU, is is always a good idea to provide this object.
*Defined in [index.ts:95](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/547328e/src/index.ts#L95)*
102
+
*Defined in [index.ts:99](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/c0792ec/src/index.ts#L99)*
103
103
104
104
Initial cache that will contain resolved dependencies. All new modules go here.
105
105
`vue` must initially be contained in this object.
106
+
[moduleCache](options.md#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.
107
+
It is recommended to provide a prototype-less object (`Object.create(null)`) to avoid potential conflict with `Object` properties (constructor, __proto__, hasOwnProperty, ...).
108
+
*
109
+
See also [[options.loadModule]].
106
110
107
111
**example:**
108
112
```javascript
109
113
...
110
-
moduleCache: {
114
+
moduleCache:Object.assign(Object.create(null), {
111
115
vue: Vue,
112
-
},
116
+
}),
113
117
...
114
118
```
115
119
@@ -119,7 +123,7 @@ Initial cache that will contain resolved dependencies. All new modules go here.
*Defined in [index.ts:230](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/547328e/src/index.ts#L230)*
191
+
*Defined in [index.ts:239](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/c0792ec/src/index.ts#L239)*
185
192
186
193
Called when the lib requires a module. Do return `undefined` to let the library handle this.
187
194
@@ -196,6 +203,8 @@ Name | Type | Description |
196
203
197
204
A Promise of the module or undefined
198
205
206
+
[moduleCache](options.md#modulecache) and [Options.loadModule](options.md#loadmodule) are strongly related, in the sense that the result of [[options.loadModule]] is stored in [moduleCache](options.md#modulecache).
207
+
However, [[options.loadModule]] is asynchronous and may help you to handle modules or components that are conditionally required (optional features, current languages, plugins, ...).
*Defined in [index.ts:211](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/547328e/src/index.ts#L211)*
224
+
*Defined in [index.ts:218](https://github.com/FranckFreiburger/vue3-sfc-loader/blob/c0792ec/src/index.ts#L218)*
216
225
217
226
Called by the library when there is somthing to log (eg. scripts compilation errors, template compilation errors, template compilation tips, style compilation errors, ...)
0 commit comments