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

Webpack v4 API inconsistencies #298

Closed
1 task
issacgerges opened this issue Jan 11, 2023 · 4 comments · Fixed by #300
Closed
1 task

Webpack v4 API inconsistencies #298

issacgerges opened this issue Jan 11, 2023 · 4 comments · Fixed by #300
Labels
bug Something isn't working pending triage released

Comments

@issacgerges
Copy link

Bug description

There are some issues with this package that can cause problems when used with webpack@4

  • The explicit dependency on webpack-sources will bring in an additional version on most versions of webpack. These sources are passed back into the webpack compilation
    • In webpack v5, these source classes are available via the compiler (example)
    • In webpack v4, I believe an explicit dependency is needed on webpack-sources@1.4.3 to match the version used by webpck/webpack
  • sourceAndMap is not consistently present on compilation sources in v4. This code should use sourceAndMap when available and fallback to a null map and source.source() (example)

Reproduction

n/a

Node.js package manager

npm

Environment

npmPackages:
  webpack: 4.x

Can you contribute a fix?

  • I’m interested in opening a pull request for this issue.
@issacgerges issacgerges added bug Something isn't working pending triage labels Jan 11, 2023
@issacgerges issacgerges changed the title Webpack v4 API inconsistencies and performance Webpack v4 API inconsistencies Jan 11, 2023
@privatenumber
Copy link
Owner

privatenumber commented Jan 12, 2023

I really appreciate this issue. Thanks for the feedback @issacgerges.

RE: First bullet
I think you're definitely right. Will fix.

RE: Second bullet
Do you have an example where sourceAndMap will not be present in Webpack 4? So far, it hasn't been a problem for me, and I feel like I'd be getting bug reports if it wasn't available. In any case, if it's possible, I'd like to cover it in a test.

@issacgerges
Copy link
Author

issacgerges commented Jan 12, 2023

No worries! I know one example is that plugins can (and sometimes do) manually add assets to the compilation, here's one such example, those usually only satisfy source and size. I'm actually no longer confident you can even rely on this in webpack@5. Even webpack does similar checks internally

@privatenumber
Copy link
Owner

Thanks @issacgerges !
Should be covered now.

@privatenumber
Copy link
Owner

🎉 This issue has been resolved in version 2.21.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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 released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants