Kotlin / kotlin-frontend-plugin

Gradle Kotlin (http://kotlinlang.org) plugin for frontend development
Apache License 2.0
561 stars 69 forks source link

missing schema error when using kotlin.js.externals Jquery #112

Open apatrida opened 5 years ago

apatrida commented 5 years ago

Adding dependency of compile "kotlin.js.externals:kotlin-js-jquery:$kotlin_jquery_version" while using the web front end plugin for Kotlin results in missing schema during npm install phase. Any ideas on what causes this? having the npm dependency listed in the NPM section of the build fiel doesn't help either.

wulf0r commented 5 years ago

I have the same problem This fails Command: cmd /C mklink /J C:\workspace\schniesel-designer-kotlin\js\build\node_modules\@kotlin-externals\jquery C:\workspace\schniesel-designer-kotlin\js\build\node_modules_imported\@kotlin-externals\jquery Successfully started process 'command 'cmd'' Das System kann den angegebenen Pfad nicht finden. :js:npm-install FAILED :js:npm-install (Thread[Task worker for ':' Thread 4,5,main]) completed. Took 1.188 secs.

At first I thought that it was because of the @ char in the path but that actually works fine, I tested it. I think it's because it wants to link into a subdirectory (@kotlin-externals) that doesnt exist yet.

wulf0r commented 5 years ago

So I actually patched up the plugin to solve this problem of the junctions parent folder not existing but then kotlin-dce-js chocked on the kjsm files in there and I got a schema missing error anyways whenever I didn't gradle clean.

This dependency is just weird compared to kotlin-html and kotlin-stdlib-js and it doesn't even include the Javascript implementation. SO the easy solution here is to have this dependency in the compileOnly scope: compileOnly "kotlin.js.externals:kotlin-js-jquery:3.2.0-0"

Of course you have to add jquery as a dependency in NPM deps: kotlinFrontend { npm { dependency "jquery" ...