Skip to content

Commit

Permalink
docs: refine documentation about comments option.
Browse files Browse the repository at this point in the history
  • Loading branch information
morganney committed Jan 28, 2024
1 parent e03caee commit 395fb2a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,13 @@ Sets how globs are matched, either the module file path, or the `import()` speci
```
**default** `'ignore'`

_Note, this option is only applied when `mode` is `parser`._

_Note, this option only considers block comments that precede the dynamic imports specifier, and any comments coming after are ignored and left intact._

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`.
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.

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.

## Examples

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "magic-comments-loader",
"version": "2.1.0",
"version": "2.1.1",
"description": "Add webpack magic comments to your dynamic imports at build time.",
"main": "dist",
"type": "module",
Expand Down

0 comments on commit 395fb2a

Please sign in to comment.