这是indexloc提供的服务,不要输入任何密码
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,7 @@ When you use legacy TypeScript decorator by enabling `emitDecoratorMetadata` in
decorators. In this case, you can give extra swc configuration in the `tsup.config.ts` file.

For example, if you have to define `useDefineForClassFields`, you can do that as follows:

```ts
import { defineConfig } from 'tsup'

Expand All @@ -626,10 +627,10 @@ export default defineConfig({
swc: {
jsc: {
transform: {
useDefineForClassFields: true
}
}
}
useDefineForClassFields: true,
},
},
},
})
```

Expand All @@ -648,9 +649,9 @@ Note: some SWC options cannot be configured:
"keepClassNames": true,
"target": "es2022"
}
```
```

You can also define a custom `.swcrc` configuration file. Just set `swcrc` to `true`
You can also define a custom `.swcrc` configuration file. Just set `swcrc` to `true`
in `tsup.config.ts` to allow SWC plugin to discover automatically your custom swc config file.

```ts
Expand All @@ -662,8 +663,8 @@ export default defineConfig({
sourcemap: true,
clean: true,
swc: {
swcrc: true
}
swcrc: true,
},
})
```

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"rollup": "^4.34.8",
"source-map": "0.8.0-beta.0",
"sucrase": "^3.35.0",
"tinyexec": "^0.3.2",
"tinyexec": "^1.0.1",
"tinyglobby": "^0.2.11",
"tree-kill": "^1.2.2"
},
Expand Down
25 changes: 12 additions & 13 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion src/esbuild/swc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ import type { Logger } from '../log'

export type SwcPluginConfig = { logger: Logger } & Options

export const swcPlugin = ({ logger, ...swcOptions }: SwcPluginConfig): Plugin => {
export const swcPlugin = ({
logger,
...swcOptions
}: SwcPluginConfig): Plugin => {
return {
name: 'swc',

Expand Down
4 changes: 2 additions & 2 deletions src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,8 @@ export type Options = {
* @default true
*/
removeNodeProtocol?: boolean
swc?: SwcPluginConfig;

swc?: SwcPluginConfig
}

export interface NormalizedExperimentalDtsConfig {
Expand Down
2 changes: 1 addition & 1 deletion vitest.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ export default defineConfig({
test: {
testTimeout: 50000,
globalSetup: 'vitest-global.ts',
include: ["test/*.test.ts", "src/**/*.test.ts"]
include: ['test/*.test.ts', 'src/**/*.test.ts'],
},
})