main
Last change
on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
811 bytes
|
Line | |
---|
1 | # babel-plugin-transform-remove-console
|
---|
2 |
|
---|
3 | This plugin removes all `console.*` calls.
|
---|
4 |
|
---|
5 | ## Example
|
---|
6 |
|
---|
7 | **In**
|
---|
8 |
|
---|
9 | ```javascript
|
---|
10 | console.log("foo");
|
---|
11 | console.error("bar");
|
---|
12 | ```
|
---|
13 |
|
---|
14 | **Out**
|
---|
15 |
|
---|
16 | ```javascript
|
---|
17 | ```
|
---|
18 |
|
---|
19 | ## Installation
|
---|
20 |
|
---|
21 | ```sh
|
---|
22 | npm install babel-plugin-transform-remove-console --save-dev
|
---|
23 | ```
|
---|
24 |
|
---|
25 | ## Usage
|
---|
26 |
|
---|
27 | ### Via `.babelrc` (Recommended)
|
---|
28 |
|
---|
29 | **.babelrc**
|
---|
30 |
|
---|
31 | ```json
|
---|
32 | // without options
|
---|
33 | {
|
---|
34 | "plugins": ["transform-remove-console"]
|
---|
35 | }
|
---|
36 | ```
|
---|
37 |
|
---|
38 | ```json
|
---|
39 | // with options
|
---|
40 | {
|
---|
41 | "plugins": [ ["transform-remove-console", { "exclude": [ "error", "warn"] }] ]
|
---|
42 | }
|
---|
43 | ```
|
---|
44 |
|
---|
45 | ### Via CLI
|
---|
46 |
|
---|
47 | ```sh
|
---|
48 | babel --plugins transform-remove-console script.js
|
---|
49 | ```
|
---|
50 |
|
---|
51 | ### Via Node API
|
---|
52 |
|
---|
53 | ```javascript
|
---|
54 | require("@babel/core").transform("code", {
|
---|
55 | plugins: ["transform-remove-console"]
|
---|
56 | });
|
---|
57 | ```
|
---|
58 |
|
---|
59 | ## Options
|
---|
60 |
|
---|
61 | + `exclude` - An array of console methods to exclude from removal.
|
---|
Note:
See
TracBrowser
for help on using the repository browser.