Skip to content
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

fix: just bundle for non-html entry #1202

Closed
wants to merge 1 commit into from
Closed

fix: just bundle for non-html entry #1202

wants to merge 1 commit into from

Conversation

lili21
Copy link
Contributor

@lili21 lili21 commented Apr 17, 2018

fix #1005

@DeMoorJasper
Copy link
Member

What about htm or something that gets transpiled to html?

Sent with GitHawk

@lili21
Copy link
Contributor Author

lili21 commented Apr 17, 2018

You can do that with parcel ? didn't know that before.

@lili21
Copy link
Contributor Author

lili21 commented Apr 17, 2018

any suggestion ?

@DeMoorJasper
Copy link
Member

DeMoorJasper commented Apr 17, 2018

This issue basically comes down to using the wrong command (serve instead of watch).
But if you really wanna change this in the code you could do this:

  async serve(port = 1234, https = false) {
    let entryType = this.parser.getAsset(this.mainFile, {}, this.options).type;
    if (entryType === 'html') {
      this.server = await Server.serve(this, port, https);
    }
    this.bundle();
    return this.server;
  }
  if (command.name() === 'serve') {
    const server = await bundler.serve(command.port || 1234, command.https);
    if (server && command.open) {
      await require('./utils/openInBrowser')(
        `${command.https ? 'https' : 'http'}://localhost:${
          server.address().port
        }`,
        command.open
      );
    }
  } else {
    bundler.bundle();
  }

@DeMoorJasper
Copy link
Member

Just wondering, this isn't related to the issue? The issue was about never starting a dev server if target is not browser as that makes no sense.
But this wouldn't start a server even if the target is browser which does make sense even for js entryAssets (although in practise perhaps a very niche use-case, this is why parcel watch exists)

@devongovett
Copy link
Member

I think there are valid use cases for running the server when the entry point isn't an HTML file. Maybe your HTML is served separately, or generated dynamically from a different server, for example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RFC] Don't start dev server for non-html entry points?
3 participants