Skip to content

Commit

Permalink
fix: use es2015 for legacy build (#36)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
ivanhofer and github-actions[bot] authored Mar 24, 2023
1 parent 23727dc commit e42d5e7
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .changeset/selfish-days-love.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"exceptionally": patch
---

use `es2015` as target fo legacy build
4 changes: 2 additions & 2 deletions .size-limit.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ const config = [
},
{
path: 'lib/index.cjs',
limit: '226 b',
limit: '192 b',
},
{
path: 'lib/index.global.js',
limit: '208 b',
limit: '176 b',
},
]

Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
- e97b58d: upgrade to TypeScript 5
- e97b58d: improve type definition for `processInParallel`

## 2.8.1

### Patch Changes

- 1c5de55: use `es2015` as target fo legacy build

## 2.8.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"---- DEV -----------------------------------------------------------------------------": "",
"dev": "tsup --watch",
"---- BUILD ---------------------------------------------------------------------------": "",
"build": "tsup",
"build": "tsup && tsup --config tsup-legacy.config.ts",
"release": "pnpm build && npm publish",
"---- TEST ----------------------------------------------------------------------------": "",
"test": "pnpm tsc && pnpm vitest",
Expand Down
8 changes: 8 additions & 0 deletions tsup-legacy.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { defineConfig } from 'tsup'
import { getTsupConfig } from './tsup.config.js'

export default defineConfig(({ watch }) => ({
...getTsupConfig(watch),
entry: ['src/legacy.ts'],
target: 'es2015',
}))
21 changes: 13 additions & 8 deletions tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import { defineConfig } from 'tsup'
import { defineConfig, type Options } from 'tsup'

export const getTsupConfig = (watch: Options['watch']) =>
({
outDir: 'lib',
format: ['esm', 'cjs', 'iife'],
dts: true,
treeshake: true,
sourcemap: !!watch,
minify: !watch,
}) satisfies Options

export default defineConfig(({ watch }) => ({
entry: ['src/index.ts', 'src/assert/index.ts', 'src/utils/index.ts', 'src/legacy.ts'],
outDir: 'lib',
format: ['esm', 'cjs', 'iife'],
dts: true,
treeshake: true,
sourcemap: !!watch,
...getTsupConfig(watch),
clean: true,
minify: !watch,
entry: ['src/index.ts', 'src/assert/index.ts', 'src/utils/index.ts'],
}))

0 comments on commit e42d5e7

Please sign in to comment.