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
Don't start server if target isn't browser #1204
Conversation
src/Bundler.js
Outdated
@@ -643,7 +643,9 @@ class Bundler extends EventEmitter { | |||
} | |||
|
|||
async serve(port = 1234, https = false) { | |||
this.server = await Server.serve(this, port, https); | |||
if (this.options.target === 'browser') { |
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.
I think we should move this check into the CLI specifically. If someone is using the Parcel API, and they call serve
, we should always start a server even if the target is node. In the CLI, we can detect the target and just call bundle
instead of serve
there.
Codecov Report
@@ Coverage Diff @@
## master #1204 +/- ##
==========================================
- Coverage 88.28% 87.38% -0.91%
==========================================
Files 77 77
Lines 4355 4113 -242
==========================================
- Hits 3845 3594 -251
- Misses 510 519 +9
Continue to review full report at Codecov.
|
src/cli.js
Outdated
|
||
if ( | ||
(command.name() === 'serve' && command.target === undefined) || | ||
'browser' |
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.
not sure I understand this logic
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.
that should've been
if (command.name() === 'serve' &&
command.target === (undefined || 'browser')) {
// Start server
}
guess I made a typo, but fixed it now
Not sure this is the right way to go. I use |
HMR still starts in watch mode. serve mode is just for running a web server as well. |
Closes #1088 Closes #1202 Closes #1005