Skip to content

Resolving .js paths in TS project #3529

Answered by chenjiahan
fregante asked this question in Q&A
Discussion options

You must be logged in to vote

Rspack provides resolve.extensionAlias as a solution to TS extension alias.

Example:

export default defineConfig({
  tools: {
    rspack: {
      resolve: {
        extensionAlias: {
          '.js': ['.ts', '.js'],
          '.jsx': ['.tsx', '.jsx'],
        },
      },
    },
  },
});

We are considering adding this configuration by default in Rsbuild, until then, you can add it manually to solve this problem.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by SoonIter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants