diff --git a/package.json b/package.json index 6edb471..5fc59a7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wds", - "version": "0.20.0", + "version": "0.20.1", "author": "Harry Brundage", "license": "MIT", "bin": { diff --git a/src/Options.ts b/src/Options.ts index d2cfc19..e370548 100644 --- a/src/Options.ts +++ b/src/Options.ts @@ -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[]; diff --git a/src/SwcCompiler.ts b/src/SwcCompiler.ts index 7cb3dd8..2566936 100644 --- a/src/SwcCompiler.ts +++ b/src/SwcCompiler.ts @@ -1,10 +1,10 @@ import type { Config, Options } from "@swc/core"; -import writeFileAtomic from "write-file-atomic"; import { transformFile } from "@swc/core"; import findRoot from "find-root"; import * as fs from "fs/promises"; import globby from "globby"; import path from "path"; +import writeFileAtomic from "write-file-atomic"; import type { Compiler } from "./Compiler"; import type { ProjectConfig } from "./Options"; import { log, projectConfig } from "./utils"; @@ -129,8 +129,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 {