Skip to content

Commit

Permalink
feat: support outDir option (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
alphaCastor committed Sep 20, 2022
1 parent a552495 commit 6453ed0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/build.ts
Expand Up @@ -8,17 +8,21 @@ import { findExports } from 'mlly'
export interface BuildModuleOptions {
rootDir: string
stub?: boolean
outDir?: string
}

export async function buildModule (opts: BuildModuleOptions) {
const { build } = await import('unbuild')

const outDir = opts.outDir || 'dist'

await build(opts.rootDir, false, {
declaration: true,
stub: opts.stub,
outDir,
entries: [
'src/module',
{ input: 'src/runtime/', outDir: 'dist/runtime', ext: 'mjs' }
{ input: 'src/runtime/', outDir: `${outDir}/runtime`, ext: 'mjs' }
],
rollup: {
emitCJS: false,
Expand Down
1 change: 1 addition & 0 deletions src/cli.ts
Expand Up @@ -10,6 +10,7 @@ async function main () {
const rootDir = resolve(args._[0] || '.')
await buildModule({
rootDir,
outDir: args.outDir,
stub: args.stub
})
}
Expand Down

0 comments on commit 6453ed0

Please sign in to comment.