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

Provide an option to disable clipboard integration? (Disable by default?) #33

Closed
1 of 3 tasks
billyjanitsch opened this issue Mar 1, 2018 · 8 comments
Closed
1 of 3 tasks

Comments

@billyjanitsch
Copy link
Contributor

  • Operating System: macOS 10.13.3
  • Node Version: 8.9.4
  • NPM Version: 5.7.1
  • webpack Version: 4.0.1
  • webpack-serve Version: 0.1.5

This issue is for a:

  • bug
  • feature request
  • modification request

Code

CLI Command
  $ webpack-serve
webpack.config.js
{} // any config will do

Expected Behavior

The clipboard integration is really cool, but in my 2 days of playing around with webpack-serve, it's bitten me several times: I've had something useful on my clipboard, and webpack-serve has overwritten it. (Since I usually use the open flag, even if my clipboard was empty, the feature wouldn't be useful for me anyway.)

It surprised me that this happened by default, and there doesn't currently seem to be a way to disable it.

Would you take a patch that adds an option to configure this? Would you allow that patch to disable the behavior by default? (Depending on your stance on cleverness, it could even disable it by default only if !!options.open.)

Actual Behavior

Any invocation of webpack-serve causes the clipboard to be overwritten with the server URL.

How Do We Reproduce?

  1. write a love letter, copy it to your clipboard
  2. start webpack-serve
  3. accidentally text your crush a link to your web server 😭
@shellscape
Copy link
Contributor

🤣 best reproduction instructions ever.

Let me dig up the request that prompted me to add that. It was based off of another popular project which did something similar, and I'd like to track that down and see how they handle the situation before we blaze a trail. I'm very open to modifying this, just want to poke around a bit first.

@shellscape
Copy link
Contributor

OK tracked it down. The suggestion was made by @ooflorent based on what micro-dev provides. There's no existing logic there for how to handle this. However, I want to appeal to new users, but at the same time I'd like it to be sane. If it's interfering with people's work, then we're not helping with that feature. I also don't want to bog down the options with a ton of small properties (webpack-dev-server did this and it drove me nuts trying to maintain).

So I'm good with being clever; disabling the copy if open options are specified. But I'm torn on how to disable that further. I'm open to thoughts on this.

@AndreasGalster
Copy link

Also, just another mention related to this: The clipboard breaks on WSL (Windows Ubuntu) since it needs to connect to a display I think, which is not available on the WSL shell.

@zenflow
Copy link
Contributor

zenflow commented Mar 2, 2018

Clipboard integration should be an opt-in feature because it can be harmful when you're uninformed (e.g. a new dev on a project). Defaults should be safe, and allow you to make optimizations as you learn how to configure.

Let's make clipboard integration an opt-in feature. I'm happy to PR if this can be approved.

@shellscape
Copy link
Contributor

shellscape commented Mar 2, 2018

@AndreasGalster when you say "breaks" do you mean that it throws an error and webpack-serve won't run? If so, please open a new issue. If not, are you just seeing the "could not copy" message in the console?

@zenflow I really don't think that it's harmful nor intrusive as has been suggested. It's different, and different is scary. There are many things on a given user's machine that utilize the clipboard and you probably don't even realize it 😄 That said, I'm not ready to disable it by default. I was skeptical about adding the feature but find it incredibly useful now. I'd like to hear from @ooflorent, who originally suggested adding that and has experience with micro-dev, which is another dev env that does the same.

I do agree with @billyjanitsch that it's redundant when the open options are specified, however. And in that case should be disabled.

@ooflorent
Copy link
Contributor

I heavily use micro-dev and now-cli. Both tools copy URL in the clipboard and it's great! When I launch one or the other I want to visit what's hosted or share the URL with my coworkers. The DX is great. Losing the clipboard content is not an issue. The first time I was like “wtf was going on?” but now I'm used to it and I love this feature!

@shellscape
Copy link
Contributor

#40 was just merged and will allow setting a clipboard option to false, or using --no-clipboard on the command line. With #41 you'll be able to use a top-level config for webpack-serve as well, so that could be an option for essentially turning it off by default. While we won't be disabling this by default, users who don't like this feature have a way around it now.

@cztomsik
Copy link

This is very unexpected, it should be opt-in.

@webpack-contrib webpack-contrib locked as resolved and limited conversation to collaborators Mar 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants