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 proxy readonly deprecated hooks error in webpack 5 #152

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix proxy readonly deprecated hooks error in webpack 5
  • Loading branch information
tanhauhau committed Nov 26, 2020
commit e631dbe8698c028c43f3921e3166003e2bf0eac2
4 changes: 4 additions & 0 deletions WrappedPlugin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ const wrapHooks = (orig, pluginName, smp, type) => {
get: (target, property) => {
const raw = Reflect.get(target, property);

if (Object.isFrozen(target)) {
return raw;
}

if (property === "tap" && typeof raw === "function")
return wrapTap(raw, pluginName, smp, type, method).bind(proxy);
if (property === "tapAsync" && typeof raw === "function")
Expand Down
2 changes: 1 addition & 1 deletion __tests__/setups/v4-html-webpack-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "v4-hard-source-webpack-plugin",
"name": "v4-html-webpack-plugin",
"version": "0.0.1",
"description": "Test webpack v4, and HTML Webpack Plugin with SMP",
"scripts": {
Expand Down
Loading