motto
motto copied to clipboard
Hangs while searching for module
I am trying to use an html to jsx converter(https://github.com/littlehaker/html-to-jsx) with motto. I'm trying to run the example code within motto but code keeps looking for a certain "util.js" file.
- Ran npm init
- npm install --save html-to-jsx
- I copied the htmltojsx/example.js to a file called html2jsx.js in my app directory
- Created the following test in main_test.go
- Run go test -run=TestNodeIntegration
func TestNodeIntegration(t *testing.T) {
m := motto.New()
m.AddPath("node_modules")
m.AddPath("node_modules/util")
v, err := m.Run("html2jsx.js")
if err != nil {
t.Error(err)
}
i, _ := v.ToString()
fmt.Println(i)
}
I added the following log statement in motto/module.go
Line 128: fmt.Println(name, choices)
Running the test yielded the following code repeated over and over.
util [/Users/alex/projects/go/src/com.abc/transpileangulartomithril/node_modules/util/node_modules/inherits/node_modules/util.js /Users/alex/projects/go/src/com.abc/transpileangulartomithril/node_modules/util/node_modules/inherits/node_modules/util.json /Users/alex/projects/go/src/com.abc/transpileangulartomithril/node_modules/util/node_modules/inherits/node_modules/util node_modules/util.js node_modules/util.json node_modules/util]
node_modules/util/util.js [node_modules/util/util.js]
/Users/alex/projects/go/src/com.abc/transpileangulartomithril/node_modules/util/support/isBuffer [/Users/alex/projects/go/src/com.abc/transpileangulartomithril/node_modules/util/support/isBuffer.js /Users/alex/projects/go/src/com.abc/transpileangulartomithril/node_modules/util/support/isBuffer.json /Users/alex/projects/go/src/com.abc/transpileangulartomithril/node_modules/util/support/isBuffer]
inherits [/Users/alex/projects/go/src/com.abc/transpileangulartomithril/node_modules/util/node_modules/inherits.js /Users/alex/projects/go/src/com.abc/transpileangulartomithril/node_modules/util/node_modules/inherits.json /Users/alex/projects/go/src/com.abc/transpileangulartomithril/node_modules/util/node_modules/inherits node_modules/inherits.js node_modules/inherits.json node_modules/inherits]
/Users/alex/projects/go/src/com.abc/transpileangulartomithril/node_modules/util/node_modules/inherits/inherits.js [/Users/alex/projects/go/src/com.abc/transpileangulartomithril/node_modules/util/node_modules/inherits/inherits.js]
util [/Users/alex/projects/go/src/com.abc/transpileangulartomithril/node_modules/util/node_modules/inherits/node_modules/util.js /Users/alex/projects/go/src/com.abc/transpileangulartomithril/node_modules/util/node_modules/inherits/node_modules/util.json /Users/alex/projects/go/src/com.abc/transpileangulartomithril/node_modules/util/node_modules/inherits/node_modules/util node_modules/util.js node_modules/util.json node_modules/util]
node_modules/util/util.js [node_modules/util/util.js]
Can't find exactly where it is trying to load util. I tried running npm install util
but that did not change anything. I was Curious if it is trying to load node module. I saw nodego but could not figure out how to use the nodego environment within motto.