Skip to content

Commit 027428e

Browse files
committed
Merge branch 'main' of https://github.com/pmndrs/koota
2 parents 0e35795 + 5f9c84f commit 027428e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

packages/publish/tsup.config.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,18 @@ import { defineConfig } from 'tsup';
33
export default defineConfig({
44
entry: ['src/index.ts', 'src/react.ts'],
55
format: ['esm', 'cjs'],
6+
// Force emitting "use strict" for ESM output
7+
// Not all bundlers and frameworks are capable of correctly transforming esm
8+
// to cjs output and koota requires strict mode to be enabled for the code to
9+
// be sound. The "use strict" directive has no ill effect when running in an
10+
// esm environment, while bringing the extra guarantee of ensuring strict mode
11+
// is used in non-conformant environments.
12+
// See https://262.ecma-international.org/5.1/#sec-C for more details.
13+
esbuildOptions: (options, { format }) => {
14+
options.banner = format === 'esm' ? {
15+
js: '\"use strict\";',
16+
} : undefined;
17+
},
618
dts: {
719
resolve: true,
820
},

0 commit comments

Comments
 (0)