Skip to content

Commit

Permalink
feat(swc): sets filename property, so to make additional swc features… (
Browse files Browse the repository at this point in the history
#1761)

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.
  • Loading branch information
klassm authored Sep 6, 2024
1 parent 8550c4b commit 5c04057
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/swc/src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ export function swc(input: Options = {}): Plugin {

return transform(code, {
...swcOptions,
sourceMaps: true
sourceMaps: true,
filename: id
});
}
};
Expand Down

0 comments on commit 5c04057

Please sign in to comment.