Skip to content

Commit

Permalink
fix: rootDir option not passed (#226)
Browse files Browse the repository at this point in the history
* fix: rootDir not passed, preset-env debug #225

* Added DEBUG to make @babel/preset-env debug

* tweaks

* let's not make unnecessary change
  • Loading branch information
renoirb authored and egoist committed Jul 22, 2019
1 parent 8f0aa1d commit f3f1be7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ cli
.example(bin => ` ${bin} --input.index src/foo.ts`)
.action(async (input, options) => {
const { Bundler } = await import('./')
const rootDir = options.rootDir || '.'
const bundler = new Bundler(
{
input: options.input || (input.length === 0 ? undefined : input),
Expand Down Expand Up @@ -91,7 +92,8 @@ cli
? 'quiet'
: undefined,
stackTrace: options.stackTrace,
configFile: options.config
configFile: options.config,
rootDir
}
)
await bundler
Expand Down
8 changes: 6 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ export class Bundler {
}
})

let { format } = this.config.output
let { format, target } = this.config.output
if (Array.isArray(format)) {
if (format.length === 0) {
format = ['cjs']
Expand All @@ -536,8 +536,12 @@ export class Bundler {

for (const source of sources) {
for (const format of formats) {
let title = `Bundle ${source.files.join(', ')} in ${format} format`
if (target) {
title += ` for target ${target}`
}
tasks.push({
title: `Bundle ${source.files.join(', ')} in ${format} format`,
title,
getConfig: async (context, task) => {
const assets: Assets = new Map()
this.bundles.add(assets)
Expand Down

0 comments on commit f3f1be7

Please sign in to comment.