-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
Add a --copy option to the serve command #1355
Conversation
Thoughts? |
docs/config.md
Outdated
@@ -66,6 +66,7 @@ module.exports = { | |||
// configure webpack-dev-server behavior | |||
devServer: { | |||
open: process.platform === 'darwin', | |||
copy: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
devServer
is used to configure webpack-dev-server
, I don't think adding a non webpack-dev-server option here is a good idea.
@@ -10,12 +10,15 @@ const defaults = { | |||
https: false | |||
} | |||
|
|||
const clipboardy = require('clipboardy') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be lazy-required only when copy is needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
@@ -149,10 +152,16 @@ module.exports = (api, options) => { | |||
return | |||
} | |||
|
|||
let copied = '' | |||
if (isFirstCompile && (args.copy || projectDevServerOptions.copy)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As @jkzing suggested I think we should keep it a command line flag only. --open
is supported in devServer
because webpack-dev-server
also supports it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
@yyx990803 done :) |
This feature will copy the local url to the clipboard.
I use this feature of https://poi.js.org/ quite a lot.
It's not as aggressive as
--open
but just as convenient :)