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

Missing feature resolveFullPaths #60

Open
luas10c opened this issue Oct 12, 2024 · 1 comment
Open

Missing feature resolveFullPaths #60

luas10c opened this issue Oct 12, 2024 · 1 comment

Comments

@luas10c
Copy link

luas10c commented Oct 12, 2024

I'm using swc to build a project that works with modules

{
// ...
"type": "module"
// ...
}

when I build using the swc cli it doesn't resolve all the paths and puts .js at the end

examples

import { database } from '#/database/drizzle'

should look like this when the build is complete

import { database } from './database/drizzle.js'

There should be an option to resolve fullpaths like this package implements.
Using this package you can use an argument that resolves all paths

https://www.npmjs.com/package/tsc-alias

// ...
  "tsc-alias": {
    "resolveFullPaths": true
  }
/// ....
@luas10c
Copy link
Author

luas10c commented Oct 12, 2024

I need to do it this way to solve the problem.

\\ ...
  "scripts": {
    // ...
    "build": "swc src -d dist --strip-leading-paths --delete-dir-on-start && tsc-alias"
    // ...
  }
// ...

.swcrc

{
  "$schema": "https://swc.rs/schema.json",
  "jsc": {
    "baseUrl": ".",
    "parser": {
      "syntax": "typescript"
    },
    "target": "es2020",
    "paths": {
      "#/*": ["./src/*"]
    }
  },
  "module": {
    "type": "es6",
    "strict": true
  }
}

tsconfig.json

{
  "compilerOptions": {
    "strict": true,
    "skipLibCheck": true,
    "esModuleInterop": true,

    "target": "es2022",
    "module": "es2020",
    "moduleResolution": "node",

    "outDir": "dist",

    "allowSyntheticDefaultImports": true,

    "paths": {
      "#/*": ["./src/*"]
    }
  },
  "tsc-alias": {
    "resolveFullPaths": true
  }
}

kdy1 added a commit that referenced this issue Oct 22, 2024
Changes

- Redesigned linked pages
- Fixed client/server component usage
- Added metadata to pages

**Home**
![CleanShot 2024-08-28 at 13 24
23@2x](https://github.com/user-attachments/assets/6b1df778-4d31-48a9-833a-47e4710c0e06)

**/versions/range**
![CleanShot 2024-08-28 at 13 24
56@2x](https://github.com/user-attachments/assets/f4fe42f2-96c3-4aa4-809f-5df42484bd4a)

**/versions/range/16**
![CleanShot 2024-08-28 at 13 24
36@2x](https://github.com/user-attachments/assets/225c9f82-8429-41ea-8c12-e32785d56d02)

---------

Co-authored-by: 강동윤 (Donny) <kdy1997.dev@gmail.com>
kdy1 added a commit that referenced this issue Oct 22, 2024
Changes

- Redesigned linked pages
- Fixed client/server component usage
- Added metadata to pages

**Home**
![CleanShot 2024-08-28 at 13 24
23@2x](https://github.com/user-attachments/assets/6b1df778-4d31-48a9-833a-47e4710c0e06)

**/versions/range**
![CleanShot 2024-08-28 at 13 24
56@2x](https://github.com/user-attachments/assets/f4fe42f2-96c3-4aa4-809f-5df42484bd4a)

**/versions/range/16**
![CleanShot 2024-08-28 at 13 24
36@2x](https://github.com/user-attachments/assets/225c9f82-8429-41ea-8c12-e32785d56d02)

---------

Co-authored-by: 강동윤 (Donny) <kdy1997.dev@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant