-
Notifications
You must be signed in to change notification settings - Fork 31
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
Listeners no longer being properly applied to chunks in v1.1.7 #34
Comments
UPDATE: var matchBgOrContentOrPage = function matchBgOrContentOrPage(name) {
return name === background || name === contentScript || contentScript && contentScript.includes(name) || name === extensionPage || extensionPage && extensionPage.includes(name);
};
return function (assets, chunks) {
console.log("entered middleware injector", chunks);
console.log(Array.from(chunks));
return Array.from(chunks).reduce(function (prev, _ref3) {
var name = _ref3.name,
files = _ref3.files;
console.log(name);
if (matchBgOrContentOrPage(name)) {
console.log('!!! Match the Bg', name, files);
files.forEach(function (entryPoint) {
console.log("Entry point: ".concat(entryPoint)); and here is the output: entered middleware injector {
'main.js': CachedSource {
_source: ConcatSource { _children: [Array], _isOptimized: false },
_cachedSourceType: undefined,
_cachedSource: undefined,
_cachedBuffer: undefined,
_cachedSize: undefined,
_cachedMaps: Map(0) {},
_cachedHashUpdate: undefined
},
'polyfills.js': CachedSource {
_source: ConcatSource { _children: [Array], _isOptimized: false },
_cachedSourceType: undefined,
_cachedSource: undefined,
_cachedBuffer: undefined,
_cachedSize: undefined,
_cachedMaps: Map(0) {},
_cachedHashUpdate: undefined
},
'styles.css': CachedSource {
_source: ConcatSource { _children: [Array], _isOptimized: false },
_cachedSourceType: undefined,
_cachedSource: undefined,
_cachedBuffer: undefined,
_cachedSize: undefined,
_cachedMaps: Map(0) {},
_cachedHashUpdate: undefined
},
'background.js': CachedSource {
_source: ConcatSource { _children: [Array], _isOptimized: false },
_cachedSourceType: undefined,
_cachedSource: undefined,
_cachedBuffer: undefined,
_cachedSize: undefined,
_cachedMaps: Map(0) {},
_cachedHashUpdate: undefined
},
'runtime.js': CachedSource {
_source: ConcatSource { _children: [Array], _isOptimized: false },
_cachedSourceType: undefined,
_cachedSource: undefined,
_cachedBuffer: undefined,
_cachedSize: undefined,
_cachedMaps: Map(0) {},
_cachedHashUpdate: undefined
},
'vendor.js': CachedSource {
_source: ConcatSource { _children: [Array], _isOptimized: false },
_cachedSourceType: undefined,
_cachedSource: undefined,
_cachedBuffer: undefined,
_cachedSize: undefined,
_cachedMaps: Map(0) {},
_cachedHashUpdate: undefined
}
}
Array from chunks [] As you can see array that from which we reduce the final source is always empty, therefore the middleware is never applied. |
I guess this is the breaking change: https://webpack.js.org/blog/2020-10-10-webpack-5-release/#arrays-to-sets. UPDATE:
and I'm getting Any idea? |
Hi, thanks for sharing these details. This extension definitely does work, and we use it here at Simplify. Can you share your webpack config as well? We will try to recreate your setup locally and see what we can find! |
Hey, thanks for the swift response! I imagined it works for you 😃. In fact I've tried for hours to see what's wrong with my environment, maybe multiple As for your request there are bad news and there are good news. And now the good news! |
This has been released in |
The fix does the work, thank you! 🥳 |
Type:
Environment:
I'm going to open a PR:
Description:
Hey guys, Kudos for taking ownership on this extension.
Is is working or still WIP? I'm trying to use it with Webpack 5 and it seems to start successfully but it doesn't actually work.
When I change the
background.js
script the change is not applied.Moreover, in the original extension I saw a lot of code getting attached to the
background.js
chunk during the build process and now the only code in chunk is my own.The text was updated successfully, but these errors were encountered: