Skip to content

Commit 5f7f805

Browse files
committed
Add target environment option
1 parent 90d02e6 commit 5f7f805

3 files changed

Lines changed: 5 additions & 1 deletion

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ 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

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 === 'browser'
210211
}),
211212
es3(),
212213
// We should upstream this to rollup

0 commit comments

Comments
 (0)