Skip to content

Commit e9683e1

Browse files
authored
Merge pull request #38 from kevlened/master
Add target environment option
2 parents 90d02e6 + 708ec4d commit e9683e1

3 files changed

Lines changed: 6 additions & 2 deletions

File tree

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,13 @@ Options:
6868
[string] [default: .]
6969
--format Only build specified formats
7070
[string] [default: es,cjs,umd]
71+
--target Specify your target environment
72+
[string] [default: node]
7173
--compress Compress output using UglifyJS
7274
[boolean] [default: true]
7375
--strict Enforce undefined global context and add "use
7476
strict" [default: false]
75-
--name Specify name exposed in UMD builds [string]
77+
--name Specify name exposed in UMD builds [string]
7678
```
7779

7880

src/cli.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ prog
1313
.option('--entry, -i', 'Entry module(s)')
1414
.option('--output, -o', 'Directory to place build files into')
1515
.option('--format, -f', 'Only build specified formats', 'es,cjs,umd')
16+
.option('--target', 'Specify your target environment', 'node')
1617
.option('--external', `Specify external dependencies, or 'all'`)
1718
.option('--compress', 'Compress output using UglifyJS', true)
1819
.option('--strict', 'Enforce undefined global context and add "use strict"')

src/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,8 @@ function createConfig(options, entry, format) {
206206
}),
207207
useNodeResolve && nodeResolve({
208208
module: true,
209-
jsnext: true
209+
jsnext: true,
210+
browser: options.target!=='node'
210211
}),
211212
es3(),
212213
// We should upstream this to rollup

0 commit comments

Comments
 (0)