File tree 1 file changed +12
-0
lines changed 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,18 @@ import { defineConfig } from 'tsup';
3
3
export default defineConfig ( {
4
4
entry : [ 'src/index.ts' , 'src/react.ts' ] ,
5
5
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
+ } ,
6
18
dts : {
7
19
resolve : true ,
8
20
} ,
You can’t perform that action at this time.
0 commit comments