awesome-webextension / webpack-target-webextension

WebExtension Target for Webpack 5. Supports code-splitting and HMR.
MIT License
46 stars 5 forks source link

Error loading dynamic modules in frames in Webpack 5 #15

Closed twschiller closed 3 years ago

twschiller commented 3 years ago

Thanks for your work on this extension! We're seeing problems with dynamic imports failing for iframes with Webpack 5. I think the problematic line might be:

https://github.com/crimx/webpack-target-webextension/blame/49b43992aafd53faf6493cbd33ba54e289ba3078/lib/background.js#L13

This should probably be sender.frameId? The sender.tab.frameId expression is undefined.

I am curious as to how this was working previously as that line has been there over a year. Maybe Chrome recently changed what's passed with sender.tab? In the MDN documentation the tab https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/MessageSender won't have a frameId

Jack-Works commented 3 years ago

I am curious as to how this was working previously as that line has been there over a year.

I think it never worked before. I rarely handle with content script within the iframe

twschiller commented 3 years ago

It did for at least 3-4 months. We have a client on Chrome using some functionality that depends on it - they started reporting problems for some their teammates last week, which makes me think it's related to a gradual rollout of a Chrome version

crimx commented 3 years ago

I see. Better support the old API as well.

twschiller commented 3 years ago

I see. Better support the old API as well.

You shouldn't need to -- sender always had the frameId with it (that's what we use in our extension in places). It's just that tab might have also had the frameId with it in Chrome

crimx commented 3 years ago

Got it. Thanks for the input.