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

jsc.paths transform produces absolute paths (Windows only) #5165

Closed
colin969 opened this issue Jul 9, 2022 · 4 comments · Fixed by #6915
Closed

jsc.paths transform produces absolute paths (Windows only) #5165

colin969 opened this issue Jul 9, 2022 · 4 comments · Fixed by #6915
Assignees
Labels
Milestone

Comments

@colin969
Copy link

colin969 commented Jul 9, 2022

Describe the bug

jsc.paths transformation produces absolute paths instead of relative paths. This only occurs on Windows, the paths are relative when run on Linux.

Example project: https://github.com/colin969/swc-issue-01-colin969

npm run build for building

Input code

No response

Config

{
  "exclude": [
    "node_modules/**"
  ],
  "module": {
    "type": "commonjs",
    "strict": true,
    "noInterop": true
  },
  "jsc": {
    "target": "es2018",
    "baseUrl": ".",
    "paths": {
      "@modules/import": ["./src/import.ts"]
    },
    "parser": {
      "syntax": "typescript",
      "decorators": true
    },
    "transform": {
      "decoratorMetadata": true
    }
  }
}

Playground link

No response

Expected behavior

./build/main.js output of

"use strict";
const _import = require("./import");
console.log(_import.test);

Actual behavior

./build/main.js output of

"use strict";
const _import = require("C:/Data/Projects/swc-bug/src/import");
console.log(_import.test);

Where C:/Data/Projects/swc-bug is the project path

Version

1.2.211

Additional context

No response

@colin969 colin969 added the C-bug label Jul 9, 2022
@kdy1 kdy1 added this to the Planned milestone Jul 9, 2022
@kdy1 kdy1 added the P-high label Aug 30, 2022
@kdy1 kdy1 self-assigned this Aug 30, 2022
@kdy1 kdy1 removed the P-high label Aug 30, 2022
@kdy1 kdy1 removed their assignment Sep 15, 2022
@kdy1 kdy1 self-assigned this Dec 22, 2022
@tiavina-mika
Copy link

Facing the same issue. Have you found a solution?

@colin969
Copy link
Author

Nope, had to go back to ttypescript and only use SWC for the frontend w/ webpack.

@kdy1
Copy link
Member

kdy1 commented Feb 8, 2023

Seems like this is fixed. I bought a Windows device and could reproduce this, but I couldn't reproduce it with a latest @swc/core.
I'll close this issue with a PR adding a test for it

@kdy1 kdy1 closed this as completed in #6915 Feb 8, 2023
kdy1 added a commit that referenced this issue Feb 8, 2023
@kdy1 kdy1 modified the milestones: Planned, v1.3.34 Feb 8, 2023
@swc-bot
Copy link
Collaborator

swc-bot commented Mar 10, 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 Mar 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

Successfully merging a pull request may close this issue.

4 participants