Skip to content

Commit

Permalink
chore: improve dist size for N* (#15331)
Browse files Browse the repository at this point in the history
  • Loading branch information
layershifter committed Jan 4, 2021
1 parent 981bbd2 commit 6d4e387
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions scripts/gulp/tasks/bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,7 @@ const packageName = config.package;
// Clean
// ----------------------------------------

task('bundle:package:clean', () =>
del(
[
`${paths.packageDist(packageName)}/es/*`,
`${paths.packageDist(packageName)}/commonjs/*`,
`${paths.packageDist(packageName)}/dts`,
],
{ force: true },
),
);
task('bundle:package:clean', () => del([`${paths.packageDist(packageName)}`], { force: true }));

// ----------------------------------------
// Build
Expand All @@ -35,15 +26,15 @@ task('bundle:package:commonjs', () =>
src(componentsSrc)
.pipe(sourcemaps.init())
.pipe(babel())
.pipe(sourcemaps.write('.'))
.pipe(sourcemaps.write())
.pipe(dest(paths.packageDist(packageName, 'commonjs'))),
);

task('bundle:package:es', () =>
src(componentsSrc)
.pipe(sourcemaps.init())
.pipe(babel({ caller: { useESModules: true } } as any))
.pipe(sourcemaps.write('.'))
.pipe(sourcemaps.write())
.pipe(dest(paths.packageDist(packageName, 'es'))),
);

Expand All @@ -53,7 +44,14 @@ task('bundle:package:types:tsc', () => {
task('bundle:package:types:copy', () => {
return src(paths.packageDist(packageName, 'dts/src/**/*.d.ts')).pipe(dest(paths.packageDist(packageName, 'es')));
});
task('bundle:package:types', series('bundle:package:types:tsc', 'bundle:package:types:copy'));
task('bundle:package:types:clean', () => {
return del([`${paths.packageDist(packageName)}/dts`], { force: true });
});

task(
'bundle:package:types',
series('bundle:package:types:tsc', 'bundle:package:types:copy', 'bundle:package:types:clean'),
);

// ----------------------------------------
// Default
Expand Down

0 comments on commit 6d4e387

Please sign in to comment.