SukkaW / foxact

React Hooks/Utils done right. For Browser, SSR, and React Server Components.
https://foxact.skk.moe
MIT License
302 stars 10 forks source link

Build Error when using `@swc/core` version greater than 1.3.75 #8

Closed Innei closed 1 year ago

Innei commented 1 year ago

When using @swc/core with a version greater than 1.3.75, the build process fails with the following error message:

[!] (plugin swc) Error: failed to handle: base_dir(``) must be absolute. Please ensure that `jsc.baseUrl` is specified correctly. This cannot be deduced by SWC itself because SWC is a transpiler and it does not try to resolve project details. In other works, SWC does not know which directory should be used as a base directory. It can be deduced if `.swcrc` is used, but if not, there are many candidates. e.g. the directory containing `package.json`, or the current working directory. Because of that, the caller (typically the developer of the JavaScript package) should specify it. If you see this error, please report an issue to the package author.

Temporary Solution:

The temporary solution for now is to pin the @swc/core version to 1.3.75 or lower.

- "@swc/core": "^1.3.75",
+ "@swc/core": "1.3.75",
SukkaW commented 1 year ago

This has been fixed with the latest version of rollup-plugin-swc3:

https://github.com/SukkaW/rollup-plugin-swc/pull/41 https://github.com/SukkaW/rollup-plugin-swc/pull/44

See also: https://github.com/SukkaW/foxact/commit/b961e9820436143fb8778c89e1d5a394c61dbb80