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

Support rspack #24

Open
singh-jay opened this issue Feb 25, 2024 · 5 comments
Open

Support rspack #24

singh-jay opened this issue Feb 25, 2024 · 5 comments
Labels
help wanted Extra attention is needed

Comments

@singh-jay
Copy link

singh-jay commented Feb 25, 2024

If the feature solves a problem you have, specify it here.

I'm trying to migrate our webpack project to rspack, everything is working except the svg-sprites, as this project is in active development, I hope you will consider support for rspack as well.

Describe the proposed feature.

Getting error -
/node_modules/svg-chunk-webpack-plugin/lib/loader.js:20
this._module.factoryMeta = this._module.factoryMeta || {};
^

TypeError: Cannot read properties of undefined (reading 'factoryMeta')
at Object.SvgChunkWebpackLoader

Describe alternatives you've considered

svg-sprite-loader

Additional context

Minimal example repo - https://github.com/singh-jay/svg-chunk-plugin-test

Importance

Nice to have

@yoriiis
Copy link
Owner

yoriiis commented Apr 3, 2024

Hello @singh-jay, thanks for your feedback.

I'm not opposed to compatibility with rspack, but it seems complicated to me because there are differences in the API.

On investigating, I can already see 2 points that pose a problem:

  1. From the loader, this._module is not available with rspack and this is used to mark SVGs for the plugin (see Nested dependencies are different between development mode and production mode webpack/webpack#12202 (comment))
  2. From the plugin, entry.chunks doesn't return anything. The getSvgsDependenciesByEntrypoint function allows you to search for SVG dependencies associated with an entrypoint.

@alexander-akait (Hi) What do you think?

@alexander-akait
Copy link
Collaborator

We can add check if (this._module) {}, it prevent from crash, but I am not sure it will work correctly, need to test, also maybe we need to more API... will be great to dicussion about it with rspack team

@yoriiis yoriiis added the help wanted Extra attention is needed label Jun 7, 2024
@yoriiis
Copy link
Owner

yoriiis commented Aug 26, 2024

We can add check if (this._module) {}, it prevent from crash, but I am not sure it will work correctly, need to test, also maybe we need to more API... will be great to dicussion about it with rspack team

Sorry for the delay, this line is important because it marks the svgs for the plugin. If it's not marked, the plugin will ignore the svg and won't work properly.

@alexander-akait Do you have contact with the rspack team? Or do you know how we could solve this problem? Thanks

@alexander-akait
Copy link
Collaborator

alexander-akait commented Aug 27, 2024

/cc @hardfist

@hardfist
Copy link

hardfist commented Aug 27, 2024

thanks,we will see whether we can be compatible with this plugin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants