Skip to content

Commit

Permalink
fix: target parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
mariuslundgard committed Aug 30, 2022
1 parent dad6871 commit 6fce2ed
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/build/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,17 @@ export async function build(options: {
const srcPath = path.resolve(cwd, config?.src || 'src')
const distPath = path.resolve(cwd, config?.dist || 'dist')

const nodeTarget = _parseNodeTarget(targetVersions)
const webTarget = _parseWebTarget(targetVersions)

if (!nodeTarget) {
throw new Error('no matching `node` target')
}

if (!webTarget) {
throw new Error('no matching `web` target')
}

const context: _BuildContext = {
config,
cwd,
Expand All @@ -59,10 +70,7 @@ export async function build(options: {
dist: path.relative(cwd, distPath),
pkg,
src: path.relative(cwd, srcPath),
target: {
node: _parseNodeTarget(targetVersions) || _DEFAULTS.target.node,
web: _parseWebTarget(targetVersions) || _DEFAULTS.target.web,
},
target: {node: nodeTarget, web: webTarget},
tsconfig,
}

Expand Down

0 comments on commit 6fce2ed

Please sign in to comment.