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 )
22
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.
46
57## Usage
68
@@ -22,13 +24,13 @@ Just make simple debug statements.
2224import { Debug } from ' webpack-strip-debug-loader'
2325
2426// Or use require if you prefer that
25- const { Debug } = require (" webpack-strip-debug-loader" )
27+ const { Debug } = require (' webpack-strip-debug-loader' )
2628
27- const debug = Debug (" feature" )
29+ const debug = Debug (' feature' )
2830const debugFoo = Debug (' foo' )
2931
3032if (somethingOfInterestHappens) {
31- debug (" something happened" )
33+ debug (' something happened' )
3234}
3335
3436if (foo) {
@@ -43,7 +45,7 @@ if (foo) {
4345
4446### Stripping
4547
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 .
4749
4850``` js
4951module: {
Original file line number Diff line number Diff line change 1- import { jest } from '@jest/globals'
2-
31import { Debug } from '../src/debug.js'
42
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+ */
98describe ( '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 ) )
1811 } )
1912} )
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 {
1010 * @see https://github.com/webpack/loader-runner/issues/61
1111 */
1212 '!**/__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' ,
1813 '!**/__tests__/__fixtures__/*.js'
1914 ] ,
2015 transform : { }
You can’t perform that action at this time.
0 commit comments