Skip to content

Commit 06a444f

Browse files
author
linfeng
committed
fix: 修复组件编译模式无差别产生 sourcemap
1 parent e17add5 commit 06a444f

1 file changed

Lines changed: 15 additions & 7 deletions

File tree

src/utils/ts-plus-babel.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,21 @@ const buildTs = (watch: boolean, outdir: string, babelOptions: any, wholeProject
2626
: path.join(sourcePath || pri.sourceRoot, srcPath.dir, '**/*.{ts,tsx}');
2727

2828
return new Promise((resolve, reject) => {
29-
getGulpByWatch(watch, targetPath)
30-
.pipe(gulpSourcemaps.init())
31-
.pipe(gulpBabel(babelOptions))
32-
.pipe(gulpSourcemaps.write())
33-
.on('error', reject)
34-
.pipe(gulp.dest(outdir))
35-
.on('end', resolve);
29+
if (globalState.isDevelopment) {
30+
getGulpByWatch(watch, targetPath)
31+
.pipe(gulpSourcemaps.init())
32+
.pipe(gulpBabel(babelOptions))
33+
.pipe(gulpSourcemaps.write())
34+
.on('error', reject)
35+
.pipe(gulp.dest(outdir))
36+
.on('end', resolve);
37+
} else {
38+
getGulpByWatch(watch, targetPath)
39+
.pipe(gulpBabel(babelOptions))
40+
.on('error', reject)
41+
.pipe(gulp.dest(outdir))
42+
.on('end', resolve);
43+
}
3644
});
3745
};
3846

0 commit comments

Comments
 (0)