-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for React hot loading.
- Loading branch information
Showing
13 changed files
with
1,030 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
|
||
BROWSERFY := $(shell command -v browserify 2> /dev/null ) | ||
|
||
clean: | ||
@echo clean up preable files... | ||
@- rm -rf package-lock.js node_modules react/preamble.js | ||
@echo cleaned up. | ||
|
||
node_modules: package.json | ||
@echo installing node dependencies | ||
@npm install | ||
|
||
node_modules/react-refresh/runtime.js: node_modules | ||
|
||
node_modules/react-refresh: node_modules/react-refresh/runtime.js | ||
@echo installing react-refresh | ||
@npm install react-refresh@latest | ||
|
||
react/preamble.js: node_modules/react-refresh/runtime.js | ||
ifndef BROWSERFY | ||
@echo browserfy not found so installing | ||
@npm install -g browserify | ||
endif | ||
@echo installing preamble | ||
@browserify react/refresh-loader.js -o react/preamble.js | ||
|
||
react: react/preamble.js | ||
|
||
test: | ||
@echo running tests... | ||
@go test -v . | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package vueglue | ||
|
||
import ( | ||
"log" | ||
"net/http" | ||
) | ||
|
||
// Redirector for dev server | ||
|
||
func (vg *VueGlue) DevServerRedirector() http.Handler { | ||
|
||
handler := func(w http.ResponseWriter, r *http.Request) { | ||
original := r.URL.Path | ||
prefix := "/dev/" | ||
if len(original) < len(prefix) || original[:len(prefix)] != prefix { | ||
http.NotFound(w, r) | ||
return | ||
} | ||
|
||
rest := original[len(prefix)-1:] | ||
log.Println("rest: ", rest) | ||
w.Header().Set("Content-Type", "application/javascript") | ||
http.Redirect(w, r, vg.DevServer+rest, http.StatusPermanentRedirect) | ||
} | ||
|
||
return http.HandlerFunc(handler) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "vueglue", | ||
"version": "1.0.0", | ||
"description": "react stubs for vueglue", | ||
"author": "Rob Thorne", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/torenware/vite-go/issues" | ||
}, | ||
"homepage": "https://github.com/torenware/vite-go#readme", | ||
"dependencies": { | ||
"react-refresh": "^0.12.0" | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#*.js | ||
|
Oops, something went wrong.