Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Different window.open in an async call behaviour between Webpack 4 & Webpack 5 #18018

Closed
samiashi opened this issue Jan 27, 2024 · 4 comments
Closed

Comments

@samiashi
Copy link

samiashi commented Jan 27, 2024

Bug report

What is the current behavior?
Using the same React component we get different experiences when building with Webpack 4 & Webpack 5 on iOS devices

Clicking a button to open a new tab in an async call would only work when building with Webpack 4.
When building with Webpack 5 the new tab does not open when you click the button. The popup gets blocked.

Note: Clicking the button on Chrome/Firefox desktop works as expected (opens new tab) on both Webpack 4 & Webpack 5.

I understand that the code that triggers the new tab might not be the best but I'm really curious to understand why this works with Webpack 4 and doesn't with Webpack 5. And how come it only seems to affect Apple devices 🤔

If the current behavior is a bug, please provide the steps to reproduce.

I've created a repo to reproduce the issue https://github.com/samiashi/react-webpack-debug
Instructions are included there as well to reproduce the issue

  1. Install the desired Webpack version (4.47.0 or 5.90.0)
  2. Run npm run start
  3. Using Xcode Simulator, open an iPhone (I've been testing with iPhone 15 running iOS 17.0) or open on real iPhone device or using Safari on Desktop
  4. Navigate to http://localhost:8080
  5. Click on the button

What is the expected behavior?
Clicking a button to open a new tab inside an async call should work when building with Webpack 4 & Webpack 5 on iOS.

Running with Webpack 4

webpack4.mov

Running with Webpack 5

webpack5.mov

Other relevant information:
webpack version: 5.90.0
Node.js version: v18.18.2
Operating System: iOS
Additional tools:

@samiashi samiashi changed the title Different behaviours between Webpack 4 & Webpack 5 Different behaviour between Webpack 4 & Webpack 5 Jan 27, 2024
@samiashi samiashi changed the title Different behaviour between Webpack 4 & Webpack 5 Different window.open in an async call behaviour between Webpack 4 & Webpack 5 Jan 27, 2024
@alexander-akait
Copy link
Member

alexander-akait commented Jan 30, 2024

Please open the safari dev tools console and look at the output

@samiashi
Copy link
Author

samiashi commented Feb 5, 2024

@alexander-akait Sadly nothing pops out in the dev console

Attached is a video of running it under Webpack 5
https://github.com/webpack/webpack/assets/10187761/68303b9f-d0ab-4cf9-a740-7ecf1e7d271e

@alexander-akait
Copy link
Member

I am sure there are no problems with webpack, we don't override your code and don't change logic, maybe something with dev env, I will investigate it later

@samiashi
Copy link
Author

samiashi commented Feb 5, 2024

Many thanks @alexander-akait
I’m very keen to hear about your findings

just to note that I get the same issue when I build for production on version 5

@webpack webpack locked and limited conversation to collaborators Feb 14, 2024
@alexander-akait alexander-akait converted this issue into discussion #18079 Feb 14, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants