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
[Rollup](http://www.rollupjs.org) plugin to remove assertion calls via [Unassert](https://github.com/unassert-js/unassert)
4
-
5
-
## Installation
6
-
7
-
```bash
8
-
yarn add --dev rollup-plugin-unassert
9
-
```
10
-
or
11
-
```bash
12
-
npm install --save-dev rollup-plugin-unassert
13
-
```
14
-
3
+
A [Rollup](http://www.rollupjs.org) plugin to remove assertion calls via [Unassert](https://github.com/unassert-js/unassert).
15
4
16
5
## Usage
17
6
18
-
As with any other Rollup plugin, just add it to the `plugins` option in your RollupJS config:
7
+
Install (`npm install --save-dev rollup-plugin-unassert` or `yarn add --dev rollup-plugin-unassert`),
8
+
then add it to the `plugins` section of your Rollup config as follows:
19
9
20
10
```js
21
-
// In rollup.config.js
22
-
importrollupUnassertfrom'rollup-plugin-unassert'
11
+
importunassertfrom'rollup-plugin-unassert'
23
12
24
13
exportdefault {
25
-
entry:'src/index.js',
26
-
dest:'dist/my-lib.js',
14
+
...
27
15
plugins: [
28
-
rollupUnassert()
16
+
unassert()
29
17
]
30
18
};
31
19
```
32
20
33
21
### Available options
34
22
35
23
This plugin accepts the following options:
24
+
36
25
*`include`: A minimatch pattern or array of minimatch patterns, controlling which files are to be handled by this plugin. By default matches `*.js` only.
37
26
*`exclude`: A minimatch pattern or array of minimatch patterns, controlling which files are to be ignored by this plugin. By default it's empty.
38
27
*`sourcemap`: A boolean controlling whether to handle any existing sourcemaps, defaults to `true`. Setting this to `false` will hide the assert calls when debugging the generated bundle.
39
28
*`assertionPatterns`: as per [unassert options](https://github.com/unassert-js/unassert#options).
40
29
*`requirePatterns`: as per [unassert options](https://github.com/unassert-js/unassert#options).
41
30
*`importPatterns`: as per [unassert options](https://github.com/unassert-js/unassert#options).
42
31
43
-
e.g.:
32
+
### Example Rollup config
44
33
45
34
```js
46
-
// In rollup.config.js
47
-
importrollupUnassertfrom'rollup-plugin-unassert'
35
+
importunassertfrom'rollup-plugin-unassert';
48
36
49
37
exportdefault {
50
-
entry:'src/index.js',
51
-
dest:'dist/my-lib.js',
38
+
input:'src/index.js',
39
+
output: {
40
+
file:'dist/my-lib.js',
41
+
},
52
42
plugins: [
53
-
rollupUnassert({
43
+
unassert({
54
44
exclude:'test/**/**.js',
55
-
requirePatterns: ['assert = require("assert")']
56
-
}),
45
+
requirePatterns: ['assert = require("assert")']
46
+
})
57
47
]
58
48
};
59
49
```
@@ -65,7 +55,6 @@ export default {
65
55
can do whatever you want with this stuff. If we meet some day, and you think
66
56
this stuff is worth it, you can buy me a beer in return.
67
57
68
-
69
-
Also, thanks for Takuto Wada for https://github.com/unassert-js/unassertify , from
58
+
Also, thanks to Takuto Wada for https://github.com/unassert-js/unassertify, from
70
59
which this project takes a lot of the code to wrap unassert.
0 commit comments