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

Add support for extensionAlias configuration #2993

Closed
jraoult opened this issue May 3, 2023 · 0 comments
Closed

Add support for extensionAlias configuration #2993

jraoult opened this issue May 3, 2023 · 0 comments
Assignees
Labels
feat New feature or request

Comments

@jraoult
Copy link

jraoult commented May 3, 2023

What problem does this feature solve?

I already added details in another closed issue but the gist of it is:

  1. I'm sharing ESM modules written with Typescript between Node and the browser
  2. I need to write the local import paths with the file extension .js because that's what Node's resolution algorithm expects
  3. I need Webpack (Rspack) to know how to map .js to .ts(x) to support this strategy as well

With Webpack I could have (inspired by this comment webpack/webpack#13252 (comment)):

extensionAlias: {
     // Make webpack try the .tsx and .tsx extensions in case the import
      // doesn't match a .js file. This is necessary to get TS and ESM to work
      // together.
      // cf. https://github.com/webpack/webpack/issues/13252#issuecomment-1170215575
      ".js": [".js", ".ts", ".tsx"],
    },

What does the proposed API of configuration look like?

Just match the Webpack configuration: https://webpack.js.org/configuration/resolve/#resolveextensionalias

@jraoult jraoult added feat New feature or request pending triage The issue/PR is currently untouched. labels May 3, 2023
@hyf0 hyf0 added p2-signifincant and removed pending triage The issue/PR is currently untouched. labels May 3, 2023
@hyf0 hyf0 added this to the Planned milestone May 3, 2023
@h-a-n-a h-a-n-a assigned Boshen and unassigned bvanjoi May 16, 2023
@jerrykingxyz jerrykingxyz modified the milestones: Planned, 0.1.13 - Patch May 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants