Skip to content

Commit 197fc4f

Browse files
authored
docs: refine documentation about comments option. (#33)
1 parent e03caee commit 197fc4f

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,13 @@ Sets how globs are matched, either the module file path, or the `import()` speci
8484
```
8585
**default** `'ignore'`
8686

87+
_Note, this option is only applied when `mode` is `parser`._
88+
8789
_Note, this option only considers block comments that precede the dynamic imports specifier, and any comments coming after are ignored and left intact._
8890

89-
Sets how dynamic imports with block comments are handled. If `ignore` is used, then it will be skipped and no magic comments from your configuration will be applied. If `replace` is used, then all found comments will be replaced with the magic comments. `append` and `prepend` add the magic comments before, or after the found comments, respectively. If a function is used it will be passed the found comments, and the magic comment string that is to be applied. The return value has the same effect as `replace`.
91+
Sets how dynamic imports with block comments are handled. If `ignore` is used, then it will be skipped and no magic comments from your configuration will be applied. If `replace` is used, then all found comments will be replaced with the magic comments. `append` and `prepend` add the magic comments after, or before the found comments, respectively.
92+
93+
When a function is used it will be passed the found comments, and the magic comment string that is to be applied. The return value has the same effect as `replace`. There is an [example of using a function](https://github.com/morganney/magic-comments-loader/blob/main/__tests__/loader.spec.js#L1137-L1154) in the loader specification.
9094

9195
## Examples
9296

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "magic-comments-loader",
3-
"version": "2.1.0",
3+
"version": "2.1.1",
44
"description": "Add webpack magic comments to your dynamic imports at build time.",
55
"main": "dist",
66
"type": "module",

0 commit comments

Comments
 (0)