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

Peer dependency issue with fork-ts-checker-webpack-plugin in rspack #5211

Closed
sivanzheng opened this issue Jan 4, 2024 · 8 comments
Closed
Labels
feat New feature or request

Comments

@sivanzheng
Copy link

What problem does this feature solve?

I'm currently using fork-ts-checker-webpack-plugin in rspack. However, fork-ts-checker-webpack-plugin has a peerDependencies requirement for webpack, which means that my project needs to install an additional webpack. This issue seems similar to #4537. I would like to know if there are any plans to address this or if there are any alternative plugins that can be used as a replacement.

What does the proposed API of configuration look like?

{
  "peerDependencies": {
    "typescript": ">3.6.0",
    "webpack": "^5.11.0"
  },
  "peerDependenciesMeta": {
    "webpack": {
      "optional": true
    },
    "@rspack/core": {
      "optional": true
    }
  }
}
@sivanzheng sivanzheng added feat New feature or request pending triage The issue/PR is currently untouched. labels Jan 4, 2024
@hardfist
Copy link
Contributor

hardfist commented Jan 4, 2024

yeah, you can make a pr to add @rspack/core as optional peerDeps of fork-ts-checker-webpack-plugin like what we do for webpack-dev-server webpack/webpack-dev-server#4778

@h-a-n-a h-a-n-a removed the pending triage The issue/PR is currently untouched. label Jan 25, 2024
@sivanzheng
Copy link
Author

yeah, you can make a pr to add @rspack/core as optional peerDeps of fork-ts-checker-webpack-plugin like what we do for webpack-dev-server webpack/webpack-dev-server#4778

I followed the approach outlined at webpack/webpack-dev-server#4778 to fork the fork-ts-checker-webpack-plugin to my local repository. I added the following to the package.json file:

"peerDependenciesMeta": {
    "webpack": {
        "optional": true
    }
}

However, when building the project, I still encounter the error: Error: Cannot find module 'webpack'.

@sivanzheng
Copy link
Author

@hardfist Are there any alternative approaches I could resolve this issue, please?

@hardfist
Copy link
Contributor

@sivanzheng can you provide a repro demo?

@sivanzheng
Copy link
Author

Archive.zip
image
@hardfist The compressed package is a demo provided for you. Running npm run build in the CI environment will reproduce the issue. The current package in the compressed file still uses fork-ts-checker-webpack-plugin. I have forked fork-ts-checker-webpack-plugin, made modifications as described above, and published it to a private repository. However, the issue persists.

@sivanzheng
Copy link
Author

@hardfist Have you had the chance to try out this demo? I look forward to your response.

@hardfist
Copy link
Contributor

hardfist commented Apr 15, 2024

image
@sivanzheng not met any problem in your project

@sivanzheng
Copy link
Author

@hardfist After multiple attempts, the problem seems to be in my build process. Thank you for your response.

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

3 participants