refactor(js): move webpack loader to src

pull/2/head
ALI Hamza 2021-03-21 12:08:27 +07:00
parent f6150013d5
commit caaad47c74
Signed by: hamza
GPG Key ID: 22473A32291F8CB6
7 changed files with 6 additions and 10 deletions

@ -2,4 +2,4 @@ module example
go 1.16 go 1.16
require gitea.teamortix.com/Team-Ortix/go-mod-wasm/wasm v0.0.0-20210320172655-205806929b8f replace gitea.teamortix.com/Team-Ortix/go-mod-wasm/wasm => /home/hamza/code/misc/go-mod-wasm/wasm

@ -1,2 +0,0 @@
gitea.teamortix.com/Team-Ortix/go-mod-wasm/wasm v0.0.0-20210320172655-205806929b8f h1:A1ImTmMMUKGRvxCXO+hQh92DAsRz37ioQGlg8dpxFjc=
gitea.teamortix.com/Team-Ortix/go-mod-wasm/wasm v0.0.0-20210320172655-205806929b8f/go.mod h1:aXGSS5eQ84RFpINcZVu4y/MeaguTCZM9RvZct1OtsE0=

@ -2,15 +2,13 @@ package main
import ( import (
"fmt" "fmt"
"syscall/js"
"gitea.teamortix.com/Team-Ortix/go-mod-wasm/wasm"
) )
func main() { func main() {
c := make(chan bool, 0)
fmt.Println("Hello from go-mod-wasm!") fmt.Println("Hello from go-mod-wasm!")
js.Global().Get("__go_wasm__").Set("__ready__", true)
wasm.Ready() c := make(chan bool, 0) // in Go Wasm, the program may not exit
<-c <-c
} }

@ -35,7 +35,7 @@ module.exports = {
test: /\.go$/, test: /\.go$/,
use: [ use: [
{ {
loader: path.resolve(__dirname, '../index.js') loader: path.resolve(__dirname, '../src/index.js')
} }
] ]
} }

@ -2,7 +2,7 @@
"name": "go-mod-wasm", "name": "go-mod-wasm",
"version": "0.1.2", "version": "0.1.2",
"description": "A webpack-based configuration to work with wasm using Go.", "description": "A webpack-based configuration to work with wasm using Go.",
"main": "index.js", "main": "src/index.js",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://gitea.teamortix.com/Team-Ortix/go-mod-wasm" "url": "https://gitea.teamortix.com/Team-Ortix/go-mod-wasm"