do you have any idea why the gradle node plugin do...
# javascript
g
do you have any idea why the gradle node plugin does not create node_modules in the
nodeModulesDir
that was set ?
so I manage to install mocha for JS test. the only problem I'm having now is the test requires kotlin modules and it gives the error on yargs. I'm unfamiliar to javascript so how/where should I put the modules required?
g
I was receiving an error like this one before. Is it something telling you that the kotlin module was not found?
Some error that appears in the browser console?
g
yes that’s it!
But I am not familiar how to expose the kotlin module to it since the JS files are generated
g
Hum, maybe I can help you. Try to use the following in your js target:
Copy code
js {
		configure(listOf(compilations["main"], compilations["test"])) {
			tasks.getByName(compileKotlinTaskName) {
				kotlinOptions {
//					languageVersion = "1.3"
					metaInfo = true
					sourceMap = true
					sourceMapEmbedSources = "always"
					moduleKind = "umd"
				}
			}
		}

		configure(listOf(compilations["main"])) {
			tasks.getByName(compileKotlinTaskName) {
				kotlinOptions {
					outputFile = "${project.buildDir.path}/classes/kotlin/js/main/SOMEPREFIX-${project.name}.js"
					main = "call"
				}
			}
		}
	}
If you are importing things from another module, for example a common one, put this in your js target in the common module too.
The line with someprefix is not really needed (I just used it because the name of my project was react too and this create conflicts, if this is not your case you don’t really need that lime)
this is for a
build.gradle.kts
script
g
thanks I’ll try this solution