Skip to content

Commit 0e72ab9

Browse files
committed
fix(build): preserve --outDir path as relative to CWD
1 parent df8c64c commit 0e72ab9

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

packages/build/bin/compile-package.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,11 @@ function run(argv, options) {
7171

7272
var outDir;
7373

74-
if (!isOutDirSet) {
74+
if (isOutDirSet) {
75+
const outDirIx = compilerOpts.indexOf('--outDir');
76+
outDir = path.resolve(process.cwd(), compilerOpts[outDirIx + 1]);
77+
compilerOpts.splice(outDirIx, 2);
78+
} else {
7579
outDir = path.join(packageDir, utils.getDistribution(target));
7680
}
7781

@@ -121,7 +125,7 @@ function run(argv, options) {
121125
}
122126

123127
if (outDir) {
124-
args.push('--outDir', outDir);
128+
args.push('--outDir', path.relative(cwd, outDir));
125129

126130
// Since outDir is set, ts files are compiled into that directory.
127131
// If ignore-resources flag is not passed, copy resources (non-ts files)

packages/build/test/integration/scripts.integration.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ describe('build', function() {
156156
true,
157157
);
158158
assert(
159-
command.indexOf('--outDir ./dist') !== -1,
159+
command.indexOf('--outDir dist') !== -1,
160160
'--outDir should be honored',
161161
);
162162
});

0 commit comments

Comments
 (0)