Skip to content

Commit

Permalink
chore: emit granular esm
Browse files Browse the repository at this point in the history
  • Loading branch information
kettanaito committed May 8, 2024
1 parent ada314b commit 984c7a4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 8 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"name": "@mswjs/source",
"version": "0.0.0",
"description": "Generate MSW request handlers from OpenAPI documents, HAR archives, and other sources.",
"main": "./lib/index.js",
"module": "./lib/index.mjs",
"types": "./lib/index.d.ts",
"main": "./lib/cjs/index.js",
"module": "./lib/esm/index.mjs",
"types": "./lib/cjs/index.d.ts",
"exports": {
".": {
"require": "./lib/index.cjs",
Expand Down
28 changes: 23 additions & 5 deletions tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
import { defineConfig } from 'tsup'
import { defineConfig, Options } from 'tsup'

export default defineConfig({
entry: ['src/index.ts'],
format: ['esm', 'cjs'],
outDir: './lib',
const commonOptions = {
clean: true,
sourcemap: true,
tsconfig: './tsconfig.build.json',
// dts: true,
} satisfies Options

const esm = defineConfig({
entry: ['src/**/*.ts'],
format: 'esm',
outDir: './lib/esm',
bundle: false,
splitting: true,
...commonOptions,
})

const cjs = defineConfig({
entry: ['src/index.ts'],
format: 'cjs',
outDir: './lib/cjs',
bundle: true,
splitting: false,
...commonOptions,
})

export default [esm, cjs]

0 comments on commit 984c7a4

Please sign in to comment.