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

[Bug]: Cannot read properties of undefined (reading 'resolve') after adding the tsConfig key #8944

Open
jonasmarco opened this issue Jan 7, 2025 · 0 comments
Labels
bug Something isn't working pending triage The issue/PR is currently untouched.

Comments

@jonasmarco
Copy link

System Info

Issue: Error when adding tsConfig key to resolve in Rspack configuration

Description

I am building an application using the Rspack library. During the setup, I attempted to add path aliases to the tsconfig.json file. According to the [Rspack documentation], this requires adding a tsConfig key under the resolve node in the rspack.config.ts file.

However, after adding the tsConfig key, the application fails to run, throwing the following error:

Cannot read properties of undefined (reading 'resolve')

Steps to Reproduce

  1. Clone the project (link below)
  2. yarn install
  3. yarn dev
  4. Attempt to run the project.

Expected Behavior

The project should compile and run successfully with the configured path aliases.

Actual Behavior

The application fails to run and throws the error:

Cannot read properties of undefined (reading 'resolve')

Relevant Code

Here is the rspack.config.ts snippet:

import { defineConfig } from 'rspack';
import path from 'path';

export default defineConfig({
  resolve: {
    tsConfig: path.resolve(__dirname, './tsconfig.json'),
  },
  // other configuration options
});

And the tsconfig.json file:

{
  "compilerOptions": {
    "baseUrl": "./src",
    "paths": {
      "@components/*": ["components/*"]
    }
  }
}

Additional Information

  • Rspack version: ^1.1.8
  • Node.js version: 20.17.0
  • Operating System: macOs

Project Link

You can find the project repository here: PROJECT_LINK

Notes

If there are any additional configurations or steps required to make this work, please let me know. Thank you for your assistance!

Details

The application fails to run and throws the error:

Cannot read properties of undefined (reading 'resolve')

Reproduce link

No response

Reproduce Steps

Steps to Reproduce

  1. Clone the project (link on description)
  2. yarn install
  3. yarn dev
  4. Attempt to run the project.
@jonasmarco jonasmarco added bug Something isn't working pending triage The issue/PR is currently untouched. labels Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pending triage The issue/PR is currently untouched.
Projects
None yet
Development

No branches or pull requests

1 participant