File tree Expand file tree Collapse file tree 7 files changed +617
-622
lines changed Expand file tree Collapse file tree 7 files changed +617
-622
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
- # webpack-strip-debug-loader
1
+ # [ ` webpack-strip-debug-loader ` ] ( https://www.npmjs.com/package/webpack-strip-debug-loader )
2
2
3
- Removes [ ` debug ` ] ( https://www.npmjs.com/package/debug ) usage from your source code during Webpack builds.
3
+ ![ CI] ( https://github.com/morganney/webpack-strip-debug-loader/actions/workflows/ci.yml/badge.svg )
4
+
5
+ Removes [ ` debug ` ] ( https://www.npmjs.com/package/debug ) usage from your source code during webpack builds.
4
6
5
7
## Usage
6
8
@@ -22,13 +24,13 @@ Just make simple debug statements.
22
24
import { Debug } from ' webpack-strip-debug-loader'
23
25
24
26
// Or use require if you prefer that
25
- const { Debug } = require (" webpack-strip-debug-loader" )
27
+ const { Debug } = require (' webpack-strip-debug-loader' )
26
28
27
- const debug = Debug (" feature" )
29
+ const debug = Debug (' feature' )
28
30
const debugFoo = Debug (' foo' )
29
31
30
32
if (somethingOfInterestHappens) {
31
- debug (" something happened" )
33
+ debug (' something happened' )
32
34
}
33
35
34
36
if (foo) {
@@ -43,7 +45,7 @@ if (foo) {
43
45
44
46
### Stripping
45
47
46
- To remove the logging and bundling of debug usage register this loader with Webpack .
48
+ To remove the logging and bundling of debug usage register this loader with webpack .
47
49
48
50
``` js
49
51
module: {
Original file line number Diff line number Diff line change 1
- import { jest } from '@jest/globals'
2
-
3
1
import { Debug } from '../src/debug.js'
4
2
5
- jest . mock ( 'debug' )
6
-
7
- let debug = null
8
-
3
+ /**
4
+ * Testing that it wraps `debug` has to wait for better
5
+ * support for mocks when using ESM
6
+ * @see https://github.com/facebook/jest/pull/10976
7
+ */
9
8
describe ( 'Debug' , ( ) => {
10
- beforeAll ( async ( ) => {
11
- ; ( { default : debug } = await import ( 'debug' ) )
12
- } )
13
-
14
- it ( 'wraps debug' , ( ) => {
15
- Debug ( 'namespace' )
16
-
17
- expect ( debug ) . toHaveBeenCalled ( )
9
+ it ( 'returns a function' , ( ) => {
10
+ expect ( Debug ( 'test' ) ) . toEqual ( expect . any ( Function ) )
18
11
} )
19
12
} )
Original file line number Diff line number Diff line change
1
+ module . exports = function ( api ) {
2
+ const env = process . env . NODE_ENV || 'development'
3
+ const presets = [
4
+ [
5
+ '@babel/preset-env' ,
6
+ {
7
+ targets : {
8
+ browsers : [ 'defaults' , 'current node' ]
9
+ } ,
10
+ modules : 'commonjs'
11
+ }
12
+ ]
13
+ ]
14
+
15
+ api . cache ( ( ) => env === 'development' )
16
+
17
+ return {
18
+ presets
19
+ }
20
+ }
Original file line number Diff line number Diff line change @@ -10,11 +10,6 @@ export default {
10
10
* @see https://github.com/webpack/loader-runner/issues/61
11
11
*/
12
12
'!**/__tests__/loader.js' ,
13
- /**
14
- * Has to wait for better support for mocks when using ESM
15
- * @see https://github.com/facebook/jest/pull/10976
16
- */
17
- '!**/__tests__/debug.js' ,
18
13
'!**/__tests__/__fixtures__/*.js'
19
14
] ,
20
15
transform : { }
You can’t perform that action at this time.
0 commit comments