Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: failed to handle: base_dir(./src) must be absolute. Please ensure that jsc.baseUrl is specified correctly. #7795

Closed
ian-at-memo opened this issue Aug 10, 2023 · 8 comments
Labels
Milestone

Comments

@ian-at-memo
Copy link

Describe the bug

Hello, I have a standard Typescript repo with a set of react components, and I am using rollup to compile them. This wasn't happening yesterday, but when I tried to do a build today upon install, I get the below error. I've looked through the src/index.ts file but there isn't a place where "./src" is called directly. Any ideas? And why is it only happening today?

src/index.ts → dist/index.js, dist/index.es.js...
thread '<unnamed>' panicked at 'base_dir(./src) must be absolute. Please ensure that `jsc.baseUrl` is specified correctly.', /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc_ecma_transforms_module-0.173.28/src/path.rs:104:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[!] (plugin swc) Error: failed to handle: base_dir(./src) must be absolute. Please ensure that `jsc.baseUrl` is specified correctly.
src/index.ts
Error: failed to handle: base_dir(./src) must be absolute. Please ensure that `jsc.baseUrl` is specified correctly.

Input code

No response

Config

No response

Playground link

No response

Expected behavior

I expected it to build as normal, which it was before installation

Actual behavior

No response

Version

^1.3.61

Additional context

No response

@ian-at-memo
Copy link
Author

I assume it was related to this merge request because it was merged yesterday and has to do with the baseUrl property?

https://github.com/swc-project/swc/pull/7775/files

@kdy1
Copy link
Member

kdy1 commented Aug 10, 2023

Read the error message. You need jsc.baseUrl in .swcrc.
And if it still occurs, please provide a repro

@kdy1 kdy1 closed this as completed Aug 10, 2023
@kdy1 kdy1 added this to the Planned milestone Aug 10, 2023
@kdy1 kdy1 closed this as not planned Won't fix, can't repro, duplicate, stale Aug 10, 2023
@ian-at-memo
Copy link
Author

ian-at-memo commented Aug 10, 2023

I did add that, I tried both of the below and it didn't do anything. Unfortunately I can't give you a repo because it's a private project on a different git host. I fixed the issue by downgrading.

{ 
    jsc: {
     baseUrl: "src"
    }
}
{ 
    jsc: {
     baseUrl: "./src"
    }
}

Edit: Also, if this is a breaking change, why did it go out in a patch version?

@kdy1
Copy link
Member

kdy1 commented Aug 10, 2023

@ian-at-memo I'm not requesting you to give the access to your repository. I'm asking for a minimal reproduction

@winstxnhdw
Copy link

winstxnhdw commented Aug 10, 2023

@kdy1 I have a daily dependabot workflow to bump swc/core on every release. The latest release broke the CI. Take a look here https://github.com/winstxnhdw/chatgpt-bill-bot/actions/runs/5823783150

You can see the PR here: winstxnhdw/chatgpt-bill-bot#88

@kdy1
Copy link
Member

kdy1 commented Aug 10, 2023

@winstxnhdw It seems like a bug of @swc-node/register.

@Brooooooklyn jsc.baseUrl should be a fully resolved value if it's passed as values instead of .swcrc.

@kdy1
Copy link
Member

kdy1 commented Aug 10, 2023

I made swc-project/swc-node#721

@swc-bot
Copy link
Collaborator

swc-bot commented Sep 15, 2023

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@swc-project swc-project locked as resolved and limited conversation to collaborators Sep 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

4 participants