From dce57bcaea2314e30f554ca9583ce8ab627f4baf Mon Sep 17 00:00:00 2001 From: Matthias Klass Date: Tue, 27 Aug 2024 13:46:24 +0200 Subject: [PATCH] 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 }); } };