From 5c04057d9009a4374fc788b392ca87996ad79875 Mon Sep 17 00:00:00 2001 From: Matthias Klass Date: Fri, 6 Sep 2024 06:54:32 +0200 Subject: [PATCH] =?UTF-8?q?feat(swc):=20sets=20filename=20property,=20so?= =?UTF-8?q?=20to=20make=20additional=20swc=20features=E2=80=A6=20(#1761)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit feat(swc): sets filename property, so to make additional swc features available Background: When using the swc rollup plugin in vitest, debugging will not work. I assume this comes from the filename property not being set, as the documentation states: ``` The filename is optional, but not all of Swc's functionality is available when the filename is unknown, because a subset of options rely on the filename for their functionality. ``` Setting a filename should not have any side effects, just make debugging and other features work. --- packages/swc/src/module.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/swc/src/module.ts b/packages/swc/src/module.ts index 84933c172..e200566dc 100644 --- a/packages/swc/src/module.ts +++ b/packages/swc/src/module.ts @@ -37,7 +37,8 @@ export function swc(input: Options = {}): Plugin { return transform(code, { ...swcOptions, - sourceMaps: true + sourceMaps: true, + filename: id }); } };