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

resolveFully don't use --out-file-extension value #9549

Closed
savi2w opened this issue Sep 11, 2024 · 3 comments
Closed

resolveFully don't use --out-file-extension value #9549

savi2w opened this issue Sep 11, 2024 · 3 comments
Labels

Comments

@savi2w
Copy link

savi2w commented Sep 11, 2024

Describe the bug

If you use resolveFully: true with e.g. --out-file-extension mjs CLI option, the compiled code will try to import relative files using a fixed *.js extension causing a ERR_MODULE_NOT_FOUND error

Input code

No response

Config

{
  "$schema": "https://swc.rs/schema.json",
  "jsc": {
    "baseUrl": ".",
    "parser": {
      "dynamicImport": true,
      "syntax": "typescript"
    },
    "target": "es2022"
  },
  "module": {
    "noInterop": true,
    "resolveFully": true,
    "strictMode": true,
    "type": "es6"
  },
  "sourceMaps": true
}

Playground link (or link to the minimal reproduction)

https://github.com/savi2w/swc-repro-1

SWC Info output

No response

Expected behavior

I think the compiled code should use the provided value of --out-file-extension CLI option to import relative files

Actual behavior

No response

Version

^0.4.0

Additional context

No response

@savi2w savi2w added the C-bug label Sep 11, 2024
@savi2w savi2w changed the title resolveFully doesn't use --out-file-extension value resolveFully don't use --out-file-extension value Sep 13, 2024
@savi2w
Copy link
Author

savi2w commented Sep 21, 2024

I want to make a PR fixing this, but I don't know if my solution is right within the swc context. It is okay if the compiled code use the extension provided by --out-file-extension flag for imports?

@savi2w savi2w closed this as completed Oct 7, 2024
@kdy1
Copy link
Member

kdy1 commented Oct 7, 2024

Yeah I think so but currently the value of --out-file-extension is not passed to @swc/core

@swc-bot
Copy link
Collaborator

swc-bot commented Nov 7, 2024

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 Nov 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

3 participants