Skip to content
This repository has been archived by the owner on Apr 8, 2019. It is now read-only.

Re-use current tab instead of open a new one #117

Closed
1 of 3 tasks
elrumordelaluz opened this issue May 7, 2018 · 7 comments · Fixed by #120
Closed
1 of 3 tasks

Re-use current tab instead of open a new one #117

elrumordelaluz opened this issue May 7, 2018 · 7 comments · Fixed by #120

Comments

@elrumordelaluz
Copy link
Contributor

elrumordelaluz commented May 7, 2018

  • Operating System: OSX
  • Node Version: 8.11.0
  • NPM Version: 6.0.0
  • webpack Version: 4.7.0
  • webpack-serve Version: 0.3.2
  • bug
  • feature request
  • modification request

Code

CLI Command
  $ webpack-serve ... # remove this block if using the API
webpack.config.js
  // If your bitchin' code blocks are over 20 lines, please paste a link to a gist
  // (https://gist.github.com).
  // additional code, HEY YO remove this block if you don't need it

Expected Behavior

Try to refresh the current browser window

Actual Behavior

Open always a new tab

New Feature Use Case

Inspired on create-react-app solution.

Since I usually use Google Chrome, I expect to stay in the same (current) browser tab
when re-launch webpack-serve, instead of use a new one and close those more.

Just curious if the Webpack people/ecosystem are interested in having this behaviour (will PR in case), since is very specific to Chrome browser in OSX platform.

Furthermore, the solution requires to have an extra file .applescript in the package.

Thoughts?

related

@shellscape
Copy link
Contributor

@elrumordelaluz thanks for the issue 🍺

If you can find a way to make that happen with https://github.com/sindresorhus/opn, you probably won't need a custom feature or option in webpack-serve, as we allow passing through most options already, and that module handles opening up your browser of choice.

@elrumordelaluz
Copy link
Contributor Author

create-react-app uses opn but tries to open the same tab using .applescrip

@shellscape
Copy link
Contributor

I would recommend using the listening event and running that AppleScript locally. That's just too much complexity for this project for a single browser on a single platform.

If you'd like to contribute an applescript file to the repo in the docs directory, we can add a note tlo the open option, and an example of how to accomplish that on a per-user basis.

@elrumordelaluz
Copy link
Contributor Author

That's just too much complexity for this project for a single browser on a single platform.

Absolutely agree

If you'd like to contribute an applescript file to the repo in the docs

Sound good for me

@elrumordelaluz
Copy link
Contributor Author

This is the file from CRA. Any advice on Licenses and so on?

The example could fit in Readme?

@shellscape
Copy link
Contributor

Well it's licensed under MIT, so you'd have to keep that header in it if you were going to use it verbatim.

The example could fit in Readme?

No, but we'd put a link to a directory in the docs directory, which would contain the example snippet needed.

@elrumordelaluz
Copy link
Contributor Author

Cool, so will add the .applescript file and another reuse-current-tab.js with the serve config

elrumordelaluz added a commit to elrumordelaluz/webpack-serve that referenced this issue May 8, 2018
Adding the `.applescript` file on the _User_ project
and calling it using `listening` event as `reuse-chrome-tab.config.js`
example show.

closes webpack-contrib#117
shellscape pushed a commit that referenced this issue May 10, 2018
Adding the `.applescript` file on the _User_ project
and calling it using `listening` event as `reuse-chrome-tab.config.js`
example show.

closes #117
shellscape pushed a commit that referenced this issue May 10, 2018
Adding the `.applescript` file on the _User_ project
and calling it using `listening` event as `reuse-chrome-tab.config.js`
example show.

closes #117
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants