UNPKG

3.2 kBPlain TextView Raw
1Advanced Options:
2
3 --insert-globals, --ig, --fast [default: false]
4
5 Skip detection and always insert definitions for process, global,
6 __filename, and __dirname.
7
8 benefit: faster builds
9 cost: extra bytes
10
11 --insert-global-vars, --igv
12
13 Comma-separated list of global variables to detect and define.
14 Default: __filename,__dirname,process,Buffer,global
15
16 --detect-globals, --dg [default: true]
17
18 Detect the presence of process, global, __filename, and __dirname and define
19 these values when present.
20
21 benefit: npm modules more likely to work
22 cost: slower builds
23
24 --ignore-missing, --im [default: false]
25
26 Ignore `require()` statements that don't resolve to anything.
27
28 --noparse=FILE
29
30 Don't parse FILE at all. This will make bundling much, much faster for giant
31 libs like jquery or threejs.
32
33 --no-builtins
34
35 Turn off builtins. This is handy when you want to run a bundle in node which
36 provides the core builtins.
37
38 --no-commondir
39
40 Turn off setting a commondir. This is useful if you want to preserve the
41 original paths that a bundle was generated with.
42
43 --no-bundle-external
44
45 Turn off bundling of all external modules. This is useful if you only want
46 to bundle your local files.
47
48 --bare
49
50 Alias for both --no-builtins, --no-commondir, and sets --insert-global-vars
51 to just "__filename,__dirname". This is handy if you want to run bundles in
52 node.
53
54 --no-browser-field, --no-bf
55
56 Turn off package.json browser field resolution. This is also handy if you
57 need to run a bundle in node.
58
59 --transform-key
60
61 Instead of the default package.json#browserify#transform field to list
62 all transforms to apply when running browserify, a custom field, like, e.g.
63 package.json#browserify#production or package.json#browserify#staging
64 can be used, by for example running:
65 * `browserify index.js --transform-key=production > bundle.js`
66 * `browserify index.js --transform-key=staging > bundle.js`
67
68 --node
69
70 Alias for --bare and --no-browser-field.
71
72 --full-paths
73
74 Turn off converting module ids into numerical indexes. This is useful for
75 preserving the original paths that a bundle was generated with.
76
77 --deps
78
79 Instead of standard bundle output, print the dependency array generated by
80 module-deps.
81
82 --no-dedupe
83
84 Turn off deduping.
85
86 --list
87
88 Print each file in the dependency graph. Useful for makefiles.
89
90 --extension=EXTENSION
91
92 Consider files with specified EXTENSION as modules, this option can used
93 multiple times.
94
95 --global-transform=MODULE, -g MODULE
96
97 Use a transform module on all files after any ordinary transforms have run.
98
99 --plugin=MODULE, -p MODULE
100
101 Register MODULE as a plugin.
102
103 --preserve-symlinks
104
105 Preserves symlinks when resolving modules.
106
107Passing arguments to transforms and plugins:
108
109 For -t, -g, and -p, you may use subarg syntax to pass options to the
110 transforms or plugin function as the second parameter. For example:
111
112 -t [ foo -x 3 --beep ]
113
114 will call the `foo` transform for each applicable file by calling:
115
116 foo(file, { x: 3, beep: true })
117