Skip to content

Commit 4348403

Browse files
sokrachenxsansnitin315
authored
docs(api): document addMissingDependency for loader context (#6132)
* document addMissingDependency * Apply suggestions from code review Co-authored-by: Nitin Kumar <snitin315@gmail.com> Co-authored-by: Sam Chen <chenxsan@gmail.com> Co-authored-by: Nitin Kumar <snitin315@gmail.com>
1 parent 276b725 commit 4348403

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/content/api/loaders.mdx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,15 @@ addDependency(file: string)
210210
dependency(file: string) // shortcut
211211
```
212212

213-
Add a file as dependency of the loader result in order to make them watchable. For example, [`sass-loader`](https://github.com/webpack-contrib/sass-loader), [`less-loader`](https://github.com/webpack-contrib/less-loader) uses this to recompile whenever any imported `css` file changes.
213+
Add an existing file as a dependency of the loader result in order to make them watchable. For example, [`sass-loader`](https://github.com/webpack-contrib/sass-loader), [`less-loader`](https://github.com/webpack-contrib/less-loader) uses this to recompile whenever any imported `css` file changes.
214+
215+
### this.addMissingDependency
216+
217+
```typescript
218+
addMissingDependency(file: string)
219+
```
220+
221+
Add a non-existing file as a dependency of the loader result in order to make them watchable. Similar to `addDependency`, but handles the creation of files during compilation before watchers are attached correctly.
214222

215223
### this.async
216224

0 commit comments

Comments
 (0)