Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

[Question] Compatibility with Webpack APIs and migrating an old custom plugin #9038

Closed
ahmedelgabri opened this issue Jan 17, 2025 · 0 comments

Comments

@ahmedelgabri
Copy link

I'm working on migrating a large and old application from Webpack to Rspack, and we currently have a blocker with one of our custom plugins. So wanted to check what our alternatives are.

The plugin in a nutshell only allows some paths to be imported inside some specific entry files, anywhere in these files graph.

new MyPlugin({
   allowedPaths: [
      'node_modules',
      'path_to_a'
   ].map((p) => path.join(process.cwd(), p)))
})

First problem: compilation.asyncEntrypoints is not supported https://rspack.dev/api/javascript-api/compilation

compiler.hooks.emit.tapAsync('MyPlugin', (compilation, callback) => {
	compilation.asyncEntrypoints.forEach(entrypoint => {
		entrypoint.chunks.forEach(chunk => {

Second problem: instanceof checks for NormalModule, ConcatenatedModule and WorkerDependency

I noticed that there is NormalModule Class but nothing for the rest.

const ConcatenatedModuleClass = require('webpack/lib/optimize/ConcatenatedModule')
const NormalModuleClass = require('webpack/lib/NormalModule')
const WorkerDependency = require('webpack/lib/dependencies/WorkerDependency')

There are probably more issues, but right we can't even run the plugin. So I was wondering what are our options here?

@ahmedelgabri ahmedelgabri changed the title [Question] Compatibility with Webpack APIs? [Question] Compatibility with Webpack APIs and migrating an old custom plugin Jan 17, 2025
@web-infra-dev web-infra-dev locked and limited conversation to collaborators Jan 26, 2025
@chenjiahan chenjiahan converted this issue into discussion #9123 Jan 26, 2025

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant