File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33// if we export it as `const importMetaUrl = ... __filename ...`
44// But using a function will not cause this issue
55
6- const getImportMetaUrl = ( ) =>
7- typeof document === "undefined"
8- ? new URL ( `file:${ __filename } ` ) . href
9- : ( document . currentScript && document . currentScript . tagName . toUpperCase ( ) === 'SCRIPT' )
10- ? document . currentScript . src
11- : new URL ( "main.js" , document . baseURI ) . href ;
6+ const getImportMetaUrl = ( ) =>
7+ typeof document === 'undefined'
8+ ? new URL ( `file:${ __filename } ` ) . href
9+ : document . currentScript &&
10+ document . currentScript . tagName . toUpperCase ( ) === 'SCRIPT'
11+ ? document . currentScript . src
12+ : new URL ( 'main.js' , document . baseURI ) . href
1213
1314export const importMetaUrl = /* @__PURE__ */ getImportMetaUrl ( )
Original file line number Diff line number Diff line change @@ -615,6 +615,7 @@ When you use legacy TypeScript decorator by enabling `emitDecoratorMetadata` in
615615decorators. In this case, you can give extra swc configuration in the ` tsup.config.ts ` file.
616616
617617For example, if you have to define ` useDefineForClassFields ` , you can do that as follows:
618+
618619``` ts
619620import { defineConfig } from ' tsup'
620621
@@ -626,10 +627,10 @@ export default defineConfig({
626627 swc: {
627628 jsc: {
628629 transform: {
629- useDefineForClassFields: true
630- }
631- }
632- }
630+ useDefineForClassFields: true ,
631+ },
632+ },
633+ },
633634})
634635```
635636
@@ -648,9 +649,9 @@ Note: some SWC options cannot be configured:
648649 "keepClassNames" : true ,
649650 "target" : " es2022"
650651}
651- ```
652+ ```
652653
653- You can also define a custom ` .swcrc ` configuration file. Just set ` swcrc ` to ` true `
654+ You can also define a custom ` .swcrc ` configuration file. Just set ` swcrc ` to ` true `
654655in ` tsup.config.ts ` to allow SWC plugin to discover automatically your custom swc config file.
655656
656657``` ts
@@ -662,8 +663,8 @@ export default defineConfig({
662663 sourcemap: true ,
663664 clean: true ,
664665 swc: {
665- swcrc: true
666- }
666+ swcrc: true ,
667+ },
667668})
668669```
669670
Original file line number Diff line number Diff line change @@ -9,7 +9,10 @@ import type { Logger } from '../log'
99
1010export type SwcPluginConfig = { logger : Logger } & Options
1111
12- export const swcPlugin = ( { logger, ...swcOptions } : SwcPluginConfig ) : Plugin => {
12+ export const swcPlugin = ( {
13+ logger,
14+ ...swcOptions
15+ } : SwcPluginConfig ) : Plugin => {
1316 return {
1417 name : 'swc' ,
1518
Original file line number Diff line number Diff line change @@ -257,8 +257,8 @@ export type Options = {
257257 * @default true
258258 */
259259 removeNodeProtocol ?: boolean
260-
261- swc ?: SwcPluginConfig ;
260+
261+ swc ?: SwcPluginConfig
262262}
263263
264264export interface NormalizedExperimentalDtsConfig {
Original file line number Diff line number Diff line change @@ -4,6 +4,6 @@ export default defineConfig({
44 test : {
55 testTimeout : 50000 ,
66 globalSetup : 'vitest-global.ts' ,
7- include : [ " test/*.test.ts" , " src/**/*.test.ts" ]
7+ include : [ ' test/*.test.ts' , ' src/**/*.test.ts' ] ,
88 } ,
99} )
You can’t perform that action at this time.
0 commit comments