Skip to content

Conversation

dmitshur
Copy link
Member

Previously, if there was already a {base}.js file on disk (possibly as a result of running gopherjs build in the past), it would take higher precedence than the freshly compiled {base}.js file. Fix that by rearranging the serving precedence logic as follows:

  1. {base}.js && valid Go command in folder -> compiled {base}.js
  2. {base}.js.map && valid Go command in folder -> compiled {base}.js.map
  3. Look in all Go workspaces (GOPATH and GOROOT)
  4. index.html && valid Go command in folder -> our own stub index.html

This way, if there's an index.html file on disk, it takes higher precedence, but not {base}.js and {base}.js.map files.

Needed for gopherjs/gopherjs.github.io#25.

dmitshur added 2 commits July 15, 2015 00:27
Previously, if there was already a {base}.js file on disk (possibly as
a result of running `gopherjs build` in the past), it would take higher
precedence than the freshly compiled {base}.js file. Fix that by
rearranging the serving precedence logic as follows:

1. {base}.js && valid Go command in folder -> compiled {base}.js
2. {base}.js.map && valid Go command in folder -> compiled {base}.js.map
3. Look in all Go workspaces (GOPATH and GOROOT)
4. index.html && valid Go command in folder -> our own stub index.html

This way, if there's an index.html file on disk, it takes higher
precedence, but not {base}.js and {base}.js.map files.
neelance added a commit that referenced this pull request Jul 15, 2015
gopherjs serve: Fix precedence of served files.
@neelance neelance merged commit 13d7ae2 into gopherjs:master Jul 15, 2015
@dmitshur dmitshur deleted the gopherjs-serve-precedence-fix branch July 15, 2015 21:28
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.

2 participants