Skip to content

Commit

Permalink
--no-browser-field and --node
Browse files Browse the repository at this point in the history
  • Loading branch information
James Halliday committed May 3, 2015
1 parent df00165 commit fe3c8a6
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 8 deletions.
11 changes: 10 additions & 1 deletion bin/advanced.txt
Expand Up @@ -51,6 +51,15 @@ Advanced Options:
to just "__filename,__dirname". This is handy if you want to run bundles in
node.

--no-browser-field, --no-bf

Turn off package.json browser field resolution. This is also handy if you
need to run a bundle in node.

--node

Alias for --bare and --no-browser-field.

--full-paths

Turn off converting module ids into numerical indexes. This is useful for
Expand All @@ -70,7 +79,7 @@ Advanced Options:
Consider files with specified EXTENSION as modules, this option can used
multiple times.

--global-transform=MODULE, --g MODULE
--global-transform=MODULE, -g MODULE

Use a transform module on all files after any ordinary transforms have run.

Expand Down
13 changes: 11 additions & 2 deletions bin/args.js
Expand Up @@ -13,12 +13,14 @@ module.exports = function (args, opts) {
var argv = subarg(args, {
'boolean': [
'deps', 'pack', 'ig', 'dg', 'im', 'd', 'list', 'builtins',
'commondir', 'bare', 'full-paths', 'bundle-external'
'commondir', 'bare', 'full-paths', 'bundle-external', 'bf',
'node'
],
string: [ 's', 'r', 'u', 'x', 't', 'i', 'o', 'e', 'c', 'it' ],
alias: {
ig: [ 'insert-globals', 'fast' ],
dg: [ 'detect-globals', 'detectGlobals', 'dg' ],
bf: [ 'browser-field', 'browserField ' ],
im: 'ignore-missing',
it: 'ignore-transform',
igv: 'insert-global-vars',
Expand All @@ -43,7 +45,9 @@ module.exports = function (args, opts) {
d: false,
builtins: true,
commondir: true,
'bundle-external': true
'bundle-external': true,
bf: true,
node: false
}
});

Expand All @@ -60,6 +64,10 @@ module.exports = function (args, opts) {
return path.resolve(process.cwd(), entry);
});

if (argv.node) {
argv.bare = true;
argv.browserField = false;
}
if (argv.bare) {
argv.builtins = false;
argv.commondir = false;
Expand All @@ -80,6 +88,7 @@ module.exports = function (args, opts) {
commondir: argv.commondir === false ? false : undefined,
bundleExternal: argv['bundle-external'],
basedir: argv.basedir,
browserField: argv.browserField,

detectGlobals: argv.detectGlobals,
insertGlobals: argv['insert-globals'] || argv.ig,
Expand Down
14 changes: 9 additions & 5 deletions readme.markdown
Expand Up @@ -159,6 +159,15 @@ Advanced Options:
to just "__filename,__dirname". This is handy if you want to run bundles in
node.
--no-browser-field, --no-bf
Turn off package.json browser field resolution. This is also handy if you
need to run a bundle in node.
--node
Alias for --bare and --no-browser-field.
--full-paths
Turn off converting module ids into numerical indexes. This is useful for
Expand All @@ -178,11 +187,6 @@ Advanced Options:
Consider files with specified EXTENSION as modules, this option can used
multiple times.
--ignore-transform=MODULE, --it MODULE
Any transforms matching the given name will be ignored, including
those in your module dependencies.
--global-transform=MODULE, -g MODULE
Use a transform module on all files after any ordinary transforms have run.
Expand Down

0 comments on commit fe3c8a6

Please sign in to comment.