Skip to content

Commit

Permalink
Merge branch 'custom-swcrc-file'
Browse files Browse the repository at this point in the history
  • Loading branch information
airhorns committed Nov 15, 2024
2 parents 7e18063 + 5c3a4e4 commit 06b2b5c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Options.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Options as SwcOptions } from "@swc/core";

type SwcConfig = ".swcrc" | SwcOptions;
export type SwcConfig = string | SwcOptions;

export interface RunOptions {
argv: string[];
Expand Down
7 changes: 5 additions & 2 deletions src/SwcCompiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,11 @@ export class SwcCompiler implements Compiler {

let swcConfig: Options;

if (!config.swc || config.swc === ".swcrc") {
swcConfig = { swcrc: true };
if (!config.swc || typeof config.swc === "string") {
swcConfig = {
swcrc: true,
configFile: config.swc && config.swc !== ".swcrc" ? path.resolve(root, config.swc) : undefined,
};
} else if (config.swc === undefined) {
swcConfig = SWC_DEFAULTS;
} else {
Expand Down

0 comments on commit 06b2b5c

Please sign in to comment.