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

fix: the source is not available on afterEmit #392

Merged
merged 1 commit into from
Apr 23, 2021

Conversation

lebleb
Copy link
Contributor

@lebleb lebleb commented Apr 23, 2021

Problem:

Plugin show an error with Webpack 5.

Error: Content and Map of this Source is not available (only size() is supported)

Why?

Webpack 5 release, replaces the source of assets with SizeOnlySource.
Official announce => https://webpack.js.org/blog/2020-10-10-webpack-5-release/#sizeonlysource-after-emit

Key idea:

Only "emit" called before "AfterEmit" has a source for assets. Use the "emit" hook only if there is hook support. So the old version of the Webpack will continue to use the "afterEmit" hook with the old plugin apply.

Closes #327

@ssick
Copy link

ssick commented Apr 23, 2021

Nice work 👍🏼

@ztoben
Copy link
Owner

ztoben commented Apr 23, 2021

This looks like it'll work, when I get a chance to test it out I'll get a new version published. Thank you!!

@tonietto
Copy link

I tested on my end and it fixes the issue! 🙌

@ztoben ztoben merged commit c4502c6 into ztoben:master Apr 23, 2021
@ztoben
Copy link
Owner

ztoben commented Apr 23, 2021

Out in v7.1.0 now 🎉

@jzimermann jzimermann deleted the fix/source_is_not_available branch April 26, 2021 07:12
weaverryan added a commit to weaverryan/webpack-encore that referenced this pull request Apr 28, 2021
ztoben/assets-webpack-plugin#392 makes our integrity
calculation no longer work, as the files have not been emitted by the time
processOutput() is called. A better fix will need to be created.
weaverryan added a commit to symfony/webpack-encore that referenced this pull request May 3, 2021
…ryan)

This PR was merged into the main branch.

Discussion
----------

Locking assets-webpack-plugin to less than 7.1.0

ztoben/assets-webpack-plugin#392 makes our integrity calculation no longer work, as the files have not been emitted by the time processOutput() is called.

A better fix will need to be created. I'll create an issue after merging this for that.

The most obvious would be to - if possible - use the existing https://github.com/ztoben/assets-webpack-plugin#integrity

If it IS possible (I don't know if it exposes all the same info we do), then we would need to deprecate the current format of the entrypoints.json file in favor of this new one.

Commits
-------

fa2c40b Locking assets-webpack-plugin to less than 7.1.0
Den-dp added a commit to Den-dp/assets-webpack-plugin that referenced this pull request May 17, 2021
To allow further refactoring/fixing of ztoben#327 since current solution breaks ztoben#404 and symfony/webpack-encore#969

Resolves: ztoben#392 ztoben#327
Den-dp added a commit to Den-dp/assets-webpack-plugin that referenced this pull request Jun 23, 2021
To allow further refactoring/fixing of ztoben#327 since current solution breaks ztoben#404 and symfony/webpack-encore#969

Resolves: ztoben#392 ztoben#327
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

integrity configuration not working
4 participants