@@ -109,9 +109,7 @@ import myLib from "imports-loader?imports=named|library|myMethod,angular!./examp
109
109
```
110
110
111
111
``` js
112
- const myLib = require (
113
- ` imports-loader?type=commonjs&imports=single|jquery|$,angular!./example.js` ,
114
- );
112
+ const myLib = require (" imports-loader?type=commonjs&imports=single|jquery|$,angular!./example.js" );
115
113
// `|` is separator in a query string, equivalently `single|jquery|$` and `angular`
116
114
// Adds the following code to the beginning of example.js:
117
115
//
@@ -124,9 +122,7 @@ const myLib = require(
124
122
```
125
123
126
124
``` js
127
- const myLib = require (
128
- ` imports-loader?type=commonjs&imports=single|myLib|myMethod&wrapper=window&!./example.js` ,
129
- );
125
+ const myLib = require (" imports-loader?type=commonjs&imports=single|myLib|myMethod&wrapper=window&!./example.js" );
130
126
// `|` is separator in a query string, equivalently `single|myLib|myMethod` and `angular`
131
127
// Adds the following code to the example.js:
132
128
//
@@ -190,13 +186,15 @@ module.exports = {
190
186
191
187
Generate output:
192
188
189
+ <!-- eslint-skip -->
190
+
193
191
``` js
192
+ import angular from " angular" ;
194
193
import $ from " jquery" ;
195
194
import lib_2_default from " lib_2" ;
196
195
import { lib2_method_1 , lib2_method_2 as lib_2_method_2_short } from " lib_3" ;
197
196
import * as my_namespace from " lib_4" ;
198
197
import " lib_5" ;
199
- import angular from " angular" ;
200
198
```
201
199
202
200
Finally, run ` webpack ` using the method you normally use (e.g., via CLI or an npm script).
@@ -250,7 +248,7 @@ module.exports = {
250
248
Generate output:
251
249
252
250
``` js
253
- var Foo = require (" Foo" );
251
+ const Foo = require (" Foo" );
254
252
255
253
// ...
256
254
// Code
@@ -308,7 +306,7 @@ type imports =
308
306
name: string ;
309
307
alias: string ;
310
308
}
311
- | Array <
309
+ | (
312
310
| string
313
311
| {
314
312
syntax:
@@ -323,7 +321,7 @@ type imports =
323
321
name: string ;
324
322
alias: string ;
325
323
}
326
- > ;
324
+ )[] ;
327
325
```
328
326
329
327
Default: ` undefined `
@@ -341,7 +339,6 @@ The `|` or `%20` (space) allow to separate the `syntax`, `moduleName`, `name` an
341
339
String syntax - ` [[syntax] [moduleName] [name] [alias]] ` or ` [[syntax]|[moduleName]|[name]|[alias]] ` , where:
342
340
343
341
- ` [syntax] ` (** may be omitted** ):
344
-
345
342
- if ` type ` is ` module ` - can be ` default ` , ` named ` , ` namespace ` or ` side-effects ` , the default value is ` default ` .
346
343
- if ` type ` is ` commonjs ` - can be ` single ` , ` multiple ` or ` pure ` , the default value is ` single ` .
347
344
@@ -433,7 +430,7 @@ module.exports = {
433
430
Generate output:
434
431
435
432
``` js
436
- var myName = require (" lib" );
433
+ const myName = require (" lib" );
437
434
438
435
// ...
439
436
// Code
@@ -447,7 +444,6 @@ Allows to use an object to describe an import.
447
444
Properties:
448
445
449
446
- ` syntax ` :
450
-
451
447
- if ` type ` is ` module ` - can be ` default ` , ` named ` , ` namespace ` or ` side-effects `
452
448
- if ` type ` is ` commonjs ` - can be ` single ` , ` multiple ` or ` pure `
453
449
@@ -543,6 +539,8 @@ module.exports = {
543
539
544
540
Generate output:
545
541
542
+ <!-- eslint-skip -->
543
+
546
544
``` js
547
545
import angular from " angular" ;
548
546
import $ from " jquery" ;
@@ -566,7 +564,7 @@ type wrapper =
566
564
| string
567
565
| {
568
566
thisArg: string ;
569
- args: Record <string , string > | Array < string > ;
567
+ args: Record <string , string > | string [] ;
570
568
};
571
569
```
572
570
@@ -610,6 +608,8 @@ module.exports = {
610
608
611
609
Generate output:
612
610
611
+ <!-- eslint-skip -->
612
+
613
613
``` js
614
614
import $ from " jquery" ;
615
615
@@ -652,14 +652,16 @@ module.exports = {
652
652
653
653
Generate output:
654
654
655
+ <!-- eslint-skip -->
656
+
655
657
``` js
656
658
import $ from " jquery" ;
657
659
658
660
(function () {
659
661
// ...
660
662
// Code
661
663
// ...
662
- }).call (window );
664
+ }).call (globalThis );
663
665
```
664
666
665
667
#### ` object `
@@ -697,14 +699,16 @@ module.exports = {
697
699
698
700
Generate output:
699
701
702
+ <!-- eslint-skip -->
703
+
700
704
``` js
701
705
import $ from " jquery" ;
702
706
703
707
(function (myVariable , myOtherVariable ) {
704
708
// ...
705
709
// Code
706
710
// ...
707
- }).call (window , myVariable, myOtherVariable);
711
+ }).call (globalThis , myVariable, myOtherVariable);
708
712
```
709
713
710
714
#### ` object ` with different parameter names
@@ -745,14 +749,16 @@ module.exports = {
745
749
746
750
Generate output:
747
751
752
+ <!-- eslint-skip -->
753
+
748
754
``` js
749
755
import $ from " jquery" ;
750
756
751
757
(function (var1 , var2 ) {
752
758
// ...
753
759
// Code
754
760
// ...
755
- }).call (window , myVariable, myOtherVariable);
761
+ }).call (globalThis , myVariable, myOtherVariable);
756
762
```
757
763
758
764
### ` additionalCode `
@@ -802,7 +808,7 @@ Generate output:
802
808
``` js
803
809
import $ from " jquery" ;
804
810
805
- var myVariable = false ;
811
+ const myVariable = false ;
806
812
807
813
// ...
808
814
// Code
@@ -843,7 +849,7 @@ Generate output:
843
849
``` js
844
850
import $ from " jquery" ;
845
851
846
- var define = false ; /* Disable AMD for misbehaving libraries */
852
+ const define = false ; /* Disable AMD for misbehaving libraries */
847
853
848
854
// ...
849
855
// Code
0 commit comments