-
Notifications
You must be signed in to change notification settings - Fork 10.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
Replace 'serve' package w/ express-static to restore compression #7139
Conversation
Deploy preview for using-postcss-sass failed. Built with commit fbe5bf4 https://app.netlify.com/sites/using-postcss-sass/deploys/5b6ab7e73813f0035e25e922 |
Sorry about the Prettier noise |
@@ -3,18 +3,18 @@ const handler = require(`serve-handler`) | |||
const openurl = require(`opn`) | |||
const http = require(`http`) | |||
const signalExit = require(`signal-exit`) | |||
const compression = require(`compression`) |
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 file has the actual changes
Deploy preview for using-drupal ready! Built with commit fbe5bf4 |
Deploy preview for gatsbygram ready! Built with commit fbe5bf4 |
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.
👍
Oh - remove |
@@ -3,18 +3,18 @@ const handler = require(`serve-handler`) | |||
const openurl = require(`opn`) |
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.
and remove Serve's serve-handler
here?
@@ -3,18 +3,18 @@ const handler = require(`serve-handler`) | |||
const openurl = require(`opn`) | |||
const http = require(`http`) |
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 can be removed I guess
Could add pathPrefix handling in here to fix #5271? |
I was experimenting on my own with Is this viable alternative? It supports quite a few options out of the box. serve.js/* @flow weak */
const openurl = require(`opn`)
const signalExit = require(`signal-exit`)
const { createServer } = require(`http-server/lib/http-server`)
module.exports = program => {
let { port, open } = program
port = typeof port === `string` ? parseInt(port, 10) : port
let server = createServer({ root: `public` })
server.listen(port, () => {
let openUrlString = `http://localhost:` + port
console.log(`gatsby serve running at:`, openUrlString)
if (open) {
let openUrlString = `http://localhost:` + port
console.log(`Opening browser...`)
openurl(openUrlString)
}
})
signalExit((code, signal) => {
server.close()
})
} |
It seems like it'd work great too! I'm not overly worried about which one we use as they're essentially all the same thing running the same node http server underneath. |
Deploy preview for gatsbyjs failed. Built with commit 9cb60d4 https://app.netlify.com/sites/gatsbyjs/deploys/5b6ab2f8c6aed62b02841c13 |
* master: (21 commits) Disable www-graphql-docker-push.sh (#7127) chore(release): Publish Fix onRouteUpdate & onPreRouteUpdate (#7142) chore(release): Publish Fix showing dev 404 page when there isn't one in development (#7140) Replace 'serve' package w/ express-static to restore compression (#7139) Fix tests (#7138) Add delay to cyress test where cyress kept failing chore(release): Publish (#6581): v2 docs building apps with gatsby overview update (#7115) Added my blog to sites (#7125) Add babel-plugin-macros (#7129) Update babel.md (#7012) (#6590): flesh out preparing your environment overview stub (#7137) [gatsby-plugin-netlify] update static cache header to match docs (#7132) (#7118): Clarify prettier instructions and update tutorial sidebar (#7130) Fixing spelling error (#7136) chore(release): Publish Try publishing again chore(release): Publish ... # Conflicts: # yarn.lock
* master: (566 commits) chore(release): Publish Fix mistakenly identifying files as using commonjs when they weren't (#7153) Update collectPackages to getPackages for new lerna rc (#7126) Update index.md (#7145) Disable www-graphql-docker-push.sh (#7127) chore(release): Publish Fix onRouteUpdate & onPreRouteUpdate (#7142) chore(release): Publish Fix showing dev 404 page when there isn't one in development (#7140) Replace 'serve' package w/ express-static to restore compression (#7139) Fix tests (#7138) Add delay to cyress test where cyress kept failing chore(release): Publish (#6581): v2 docs building apps with gatsby overview update (#7115) Added my blog to sites (#7125) Add babel-plugin-macros (#7129) Update babel.md (#7012) (#6590): flesh out preparing your environment overview stub (#7137) [gatsby-plugin-netlify] update static cache header to match docs (#7132) (#7118): Clarify prettier instructions and update tutorial sidebar (#7130) ... # Conflicts: # yarn.lock
…sbyjs#7139) * Replace 'serve' package w/ express-static to restore compression fixes gatsbyjs#7119 * Remove serve
fixes #7119