Comments (14)
good point, frontend-plugin is unable to see npm dependencies for external jar dependencies so there is no way to guess it without package.json.
What you need is ability to invoke package.json
generation task (npm-configure
) with no npm-install
task. For now it's not so easy (possible but slightly difficult to discover how)
from kotlin-frontend-plugin.
Unfortunately HMR with multimodule frontend project is not yet supported. Let me look at it what can I do
from kotlin-frontend-plugin.
Could you please tell me what does take so long in your configuration? Do you have frontend plugin in every module ?
from kotlin-frontend-plugin.
Hey man! Probably what is getting it slow its the NPM. Try to add support to yarn as a configuration and I think that will resolve it.
from kotlin-frontend-plugin.
@danfma have you tried to configure cache-min in npmrc ?
from kotlin-frontend-plugin.
No, I didn't know about that configuration setting of NPM. I will try it and then I give you a new feedback!
from kotlin-frontend-plugin.
Check the time!
danfma@WhiteFang ~/D/p/kodando-libraries> ./gradlew build
Starting a Gradle Daemon, 1 stopped Daemon could not be reused, use --status for details
:kodando-history:npm-preunpack
>> Copy from /Users/danfma/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-js/1.1.1/260a9dc3039aee5efea1d57a6a8ee1707361ed5/kotlin-stdlib-js-1.1.1.jar to /Users/danfma/Developer/playground/kodando-libraries/kodando-history/build/node_modules/kotlin
:kodando-history:npm-configure
:kodando-history:npm-install
:kodando-history:npm-index
:kodando-history:npm-deps
:kodando-history:npm
:kodando-history:packages
:kodando-runtime:compileJava UP-TO-DATE
:kodando-runtime:npm-preunpack UP-TO-DATE
:kodando-runtime:npm-configure UP-TO-DATE
:kodando-runtime:npm-install
:kodando-runtime:npm-index
:kodando-runtime:npm-deps
:kodando-runtime:npm
:kodando-runtime:packages
:kodando-runtime:compileKotlin2Js
w: Module "kotlin" is defined in more, than one file
w: /Users/danfma/Developer/playground/kodando-libraries/kodando-runtime/src/main/kotlin/kodando/runtime/async/async.kt: (10, 22): The feature "coroutines" is experimental (see: https://kotlinlang.org/docs/diagnostics/experimental-coroutines)
w: /Users/danfma/Developer/playground/kodando-libraries/kodando-runtime/src/main/kotlin/kodando/runtime/async/await.kt: (10, 1): The feature "coroutines" is experimental (see: https://kotlinlang.org/docs/diagnostics/experimental-coroutines)
w: /Users/danfma/Developer/playground/kodando-libraries/kodando-runtime/src/main/kotlin/kodando/runtime/async/await.kt: (17, 1): The feature "coroutines" is experimental (see: https://kotlinlang.org/docs/diagnostics/experimental-coroutines)
:kodando-runtime:processResources UP-TO-DATE
:kodando-runtime:classes
:kodando-runtime:jar
:kodando-history:compileKotlin2Js
w: Module "kotlin" is defined in more, than one file
w: Module "kodando-runtime" is defined in more, than one file
w: Module "kodando-runtime_main" is defined in more, than one file
:kodando-history:bundle
:kodando-history:compileJava UP-TO-DATE
:kodando-history:processResources UP-TO-DATE
:kodando-history:classes
:kodando-history:jar
:kodando-history:assemble
:kodando-history:compileTestKotlin2Js UP-TO-DATE
:kodando-history:karma-start SKIPPED
:kodando-history:compileTestJava UP-TO-DATE
:kodando-history:processTestResources UP-TO-DATE
:kodando-history:testClasses UP-TO-DATE
:kodando-history:test UP-TO-DATE
:kodando-history:check UP-TO-DATE
:kodando-history:build
:kodando-react:npm-preunpack
>> Copy from /Users/danfma/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-js/1.1.1/260a9dc3039aee5efea1d57a6a8ee1707361ed5/kotlin-stdlib-js-1.1.1.jar to /Users/danfma/Developer/playground/kodando-libraries/kodando-react/build/node_modules/kotlin
>> Copy from /Users/danfma/Developer/playground/kodando-libraries/kodando-runtime/build/libs/kodando-runtime-0.3.0.jar to /Users/danfma/Developer/playground/kodando-libraries/kodando-react/build/node_modules/kodando-runtime
:kodando-react:npm-configure
:kodando-react:npm-install
:kodando-react:npm-index
:kodando-react:npm-deps
:kodando-react:npm
:kodando-react:packages
:kodando-react:compileKotlin2Js
w: Module "kotlin" is defined in more, than one file
w: Module "kodando-runtime" is defined in more, than one file
w: Module "kodando-runtime_main" is defined in more, than one file
w: /Users/danfma/Developer/playground/kodando-libraries/kodando-react/src/main/kotlin/kodando/react/ReactChildren.kt: (77, 31): Unchecked cast: ReactChildren? to Array<ReactElement?>
w: /Users/danfma/Developer/playground/kodando-libraries/kodando-react/src/main/kotlin/kodando/react/ReactElement.kt: (7, 1): Expected performance impact of inlining 'public inline fun raw(something: Any?): ReactElement? defined in kodando.react' can be insignificant. Inlining works best for functions with lambda parameters
w: /Users/danfma/Developer/playground/kodando-libraries/kodando-react/src/main/kotlin/kodando/react/ReactElement.kt: (9, 1): Expected performance impact of inlining 'public inline fun all(vararg elements: ReactElement?): ReactElement? defined in kodando.react' can be insignificant. Inlining works best for functions with lambda parameters
w: /Users/danfma/Developer/playground/kodando-libraries/kodando-react/src/main/kotlin/kodando/react/ReactProps.kt: (44, 44): Parameter 'except' is never used
w: /Users/danfma/Developer/playground/kodando-libraries/kodando-react/src/main/kotlin/kodando/react/ReactProps.kt: (45, 9): Variable 'json' is never used
w: /Users/danfma/Developer/playground/kodando-libraries/kodando-react/src/main/kotlin/kodando/react/ReactProps.kt: (46, 9): Variable 'otherJson' is never used
:kodando-react:bundle
:kodando-react:compileJava UP-TO-DATE
:kodando-react:processResources UP-TO-DATE
:kodando-react:classes
:kodando-react:jar
:kodando-react:assemble
:kodando-react:compileTestKotlin2Js UP-TO-DATE
:kodando-react:karma-start SKIPPED
:kodando-react:compileTestJava UP-TO-DATE
:kodando-react:processTestResources UP-TO-DATE
:kodando-react:testClasses UP-TO-DATE
:kodando-react:test UP-TO-DATE
:kodando-react:check UP-TO-DATE
:kodando-react:build
:kodando-react-dom:npm-preunpack
>> Copy from /Users/danfma/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-js/1.1.1/260a9dc3039aee5efea1d57a6a8ee1707361ed5/kotlin-stdlib-js-1.1.1.jar to /Users/danfma/Developer/playground/kodando-libraries/kodando-react-dom/build/node_modules/kotlin
>> Copy from /Users/danfma/Developer/playground/kodando-libraries/kodando-runtime/build/libs/kodando-runtime-0.3.0.jar to /Users/danfma/Developer/playground/kodando-libraries/kodando-react-dom/build/node_modules/kodando-runtime
>> Copy from /Users/danfma/Developer/playground/kodando-libraries/kodando-react/build/libs/kodando-react-15.5.4-v1.0.jar to /Users/danfma/Developer/playground/kodando-libraries/kodando-react-dom/build/node_modules/kodando-react
:kodando-react-dom:npm-configure
:kodando-react-dom:npm-install
:kodando-react-dom:npm-index
:kodando-react-dom:npm-deps
:kodando-react-dom:npm
:kodando-react-dom:packages
:kodando-react-dom:compileKotlin2Js
w: Module "kotlin" is defined in more, than one file
w: Module "kodando-runtime" is defined in more, than one file
w: Module "kodando-runtime_main" is defined in more, than one file
w: Module "kodando-react" is defined in more, than one file
w: Module "kodando-react_main" is defined in more, than one file
:kodando-react-dom:bundle
:kodando-react-dom:compileJava UP-TO-DATE
:kodando-react-dom:processResources UP-TO-DATE
:kodando-react-dom:classes
:kodando-react-dom:jar
:kodando-react-dom:assemble
:kodando-react-dom:compileTestKotlin2Js UP-TO-DATE
:kodando-react-dom:karma-start SKIPPED
:kodando-react-dom:compileTestJava UP-TO-DATE
:kodando-react-dom:processTestResources UP-TO-DATE
:kodando-react-dom:testClasses UP-TO-DATE
:kodando-react-dom:test UP-TO-DATE
:kodando-react-dom:check UP-TO-DATE
:kodando-react-dom:build
:kodando-react-router-dom:npm-preunpack
>> Copy from /Users/danfma/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-js/1.1.1/260a9dc3039aee5efea1d57a6a8ee1707361ed5/kotlin-stdlib-js-1.1.1.jar to /Users/danfma/Developer/playground/kodando-libraries/kodando-react-router-dom/build/node_modules/kotlin
>> Copy from /Users/danfma/Developer/playground/kodando-libraries/kodando-runtime/build/libs/kodando-runtime-0.3.0.jar to /Users/danfma/Developer/playground/kodando-libraries/kodando-react-router-dom/build/node_modules/kodando-runtime
>> Copy from /Users/danfma/Developer/playground/kodando-libraries/kodando-react/build/libs/kodando-react-15.5.4-v1.0.jar to /Users/danfma/Developer/playground/kodando-libraries/kodando-react-router-dom/build/node_modules/kodando-react
>> Copy from /Users/danfma/Developer/playground/kodando-libraries/kodando-react-dom/build/libs/kodando-react-dom-15.5.4-v1.0.jar to /Users/danfma/Developer/playground/kodando-libraries/kodando-react-router-dom/build/node_modules/kodando-react-dom
>> Copy from /Users/danfma/Developer/playground/kodando-libraries/kodando-history/build/libs/kodando-history-4.5.1-v4.0.jar to /Users/danfma/Developer/playground/kodando-libraries/kodando-react-router-dom/build/node_modules/kodando-history
:kodando-react-router-dom:npm-configure
:kodando-react-router-dom:npm-install
:kodando-react-router-dom:npm-index
:kodando-react-router-dom:npm-deps
:kodando-react-router-dom:npm
:kodando-react-router-dom:packages
:kodando-react-router-dom:compileKotlin2Js
w: Module "kotlin" is defined in more, than one file
w: Module "kodando-runtime" is defined in more, than one file
w: Module "kodando-runtime_main" is defined in more, than one file
w: Module "kodando-react" is defined in more, than one file
w: Module "kodando-react_main" is defined in more, than one file
w: Module "kodando-react-dom" is defined in more, than one file
w: Module "kodando-react-dom_main" is defined in more, than one file
w: Module "kodando-history" is defined in more, than one file
w: Module "kodando-history_main" is defined in more, than one file
:kodando-react-router-dom:bundle
:kodando-react-router-dom:compileJava UP-TO-DATE
:kodando-react-router-dom:processResources UP-TO-DATE
:kodando-react-router-dom:classes
:kodando-react-router-dom:jar
:kodando-react-router-dom:assemble
:kodando-react-router-dom:compileTestKotlin2Js UP-TO-DATE
:kodando-react-router-dom:karma-start SKIPPED
:kodando-react-router-dom:compileTestJava UP-TO-DATE
:kodando-react-router-dom:processTestResources UP-TO-DATE
:kodando-react-router-dom:testClasses UP-TO-DATE
:kodando-react-router-dom:test UP-TO-DATE
:kodando-react-router-dom:check UP-TO-DATE
:kodando-react-router-dom:build
:kodando-runtime:bundle
:kodando-runtime:assemble
:kodando-runtime:compileTestKotlin2Js UP-TO-DATE
:kodando-runtime:karma-start SKIPPED
:kodando-runtime:compileTestJava UP-TO-DATE
:kodando-runtime:processTestResources UP-TO-DATE
:kodando-runtime:testClasses UP-TO-DATE
:kodando-runtime:test UP-TO-DATE
:kodando-runtime:check UP-TO-DATE
:kodando-runtime:build
:kodando-rxjs:npm-preunpack
>> Copy from /Users/danfma/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-js/1.1.1/260a9dc3039aee5efea1d57a6a8ee1707361ed5/kotlin-stdlib-js-1.1.1.jar to /Users/danfma/Developer/playground/kodando-libraries/kodando-rxjs/build/node_modules/kotlin
>> Copy from /Users/danfma/Developer/playground/kodando-libraries/kodando-runtime/build/libs/kodando-runtime-0.3.0.jar to /Users/danfma/Developer/playground/kodando-libraries/kodando-rxjs/build/node_modules/kodando-runtime
:kodando-rxjs:npm-configure
:kodando-rxjs:npm-install
:kodando-rxjs:npm-index
:kodando-rxjs:npm-deps
:kodando-rxjs:npm
:kodando-rxjs:packages
:kodando-rxjs:compileKotlin2Js
w: Module "kotlin" is defined in more, than one file
w: Module "kodando-runtime" is defined in more, than one file
w: Module "kodando-runtime_main" is defined in more, than one file
w: /Users/danfma/Developer/playground/kodando-libraries/kodando-rxjs/src/main/kotlin/kodando/rxjs/operators.kt: (87, 48): Parameter 'mapper' is never used
w: /Users/danfma/Developer/playground/kodando-libraries/kodando-rxjs/src/main/kotlin/kodando/rxjs/operators.kt: (92, 61): Parameter 'mapper' is never used
w: /Users/danfma/Developer/playground/kodando-libraries/kodando-rxjs/src/main/kotlin/kodando/rxjs/operators.kt: (92, 89): Parameter 'equalityHandler' is never used
:kodando-rxjs:bundle
:kodando-rxjs:compileJava UP-TO-DATE
:kodando-rxjs:processResources UP-TO-DATE
:kodando-rxjs:classes
:kodando-rxjs:jar
:kodando-rxjs:assemble
:kodando-rxjs:compileTestKotlin2Js UP-TO-DATE
:kodando-rxjs:karma-start SKIPPED
:kodando-rxjs:compileTestJava UP-TO-DATE
:kodando-rxjs:processTestResources UP-TO-DATE
:kodando-rxjs:testClasses UP-TO-DATE
:kodando-rxjs:test UP-TO-DATE
:kodando-rxjs:check UP-TO-DATE
:kodando-rxjs:build
:samples:sample-react-navigation:npm-preunpack
>> Copy from /Users/danfma/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-js/1.1.1/260a9dc3039aee5efea1d57a6a8ee1707361ed5/kotlin-stdlib-js-1.1.1.jar to /Users/danfma/Developer/playground/kodando-libraries/samples/sample-react-navigation/build/node_modules/kotlin
>> Copy from /Users/danfma/Developer/playground/kodando-libraries/kodando-runtime/build/libs/kodando-runtime-0.3.0.jar to /Users/danfma/Developer/playground/kodando-libraries/samples/sample-react-navigation/build/node_modules/kodando-runtime
>> Copy from /Users/danfma/Developer/playground/kodando-libraries/kodando-react/build/libs/kodando-react-15.5.4-v1.0.jar to /Users/danfma/Developer/playground/kodando-libraries/samples/sample-react-navigation/build/node_modules/kodando-react
>> Copy from /Users/danfma/Developer/playground/kodando-libraries/kodando-react-dom/build/libs/kodando-react-dom-15.5.4-v1.0.jar to /Users/danfma/Developer/playground/kodando-libraries/samples/sample-react-navigation/build/node_modules/kodando-react-dom
>> Copy from /Users/danfma/Developer/playground/kodando-libraries/kodando-react-router-dom/build/libs/kodando-react-router-dom-15.5.4-v1.0.jar to /Users/danfma/Developer/playground/kodando-libraries/samples/sample-react-navigation/build/node_modules/kodando-react-router-dom
>> Copy from /Users/danfma/Developer/playground/kodando-libraries/kodando-history/build/libs/kodando-history-4.5.1-v4.0.jar to /Users/danfma/Developer/playground/kodando-libraries/samples/sample-react-navigation/build/node_modules/kodando-history
:samples:sample-react-navigation:npm-configure
:samples:sample-react-navigation:npm-install
:samples:sample-react-navigation:npm-index
:samples:sample-react-navigation:npm-deps
:samples:sample-react-navigation:npm
:samples:sample-react-navigation:packages
:samples:sample-react-navigation:compileKotlin2Js
w: Module "kotlin" is defined in more, than one file
w: Module "kodando-runtime" is defined in more, than one file
w: Module "kodando-runtime_main" is defined in more, than one file
w: Module "kodando-react" is defined in more, than one file
w: Module "kodando-react_main" is defined in more, than one file
w: Module "kodando-history" is defined in more, than one file
w: Module "kodando-history_main" is defined in more, than one file
w: Module "kodando-react-dom" is defined in more, than one file
w: Module "kodando-react-dom_main" is defined in more, than one file
w: Module "kodando-react-router-dom" is defined in more, than one file
w: Module "kodando-react-router-dom_main" is defined in more, than one file
:samples:sample-react-navigation:webpack-config
:samples:sample-react-navigation:webpack-helper SKIPPED
:samples:sample-react-navigation:webpack-bundle
:samples:sample-react-navigation:bundle
:samples:sample-react-navigation:compileJava UP-TO-DATE
:samples:sample-react-navigation:processResources UP-TO-DATE
:samples:sample-react-navigation:classes
:samples:sample-react-navigation:jar
:samples:sample-react-navigation:assemble
:samples:sample-react-navigation:compileTestKotlin2Js UP-TO-DATE
:samples:sample-react-navigation:karma-start SKIPPED
:samples:sample-react-navigation:compileTestJava UP-TO-DATE
:samples:sample-react-navigation:processTestResources UP-TO-DATE
:samples:sample-react-navigation:testClasses UP-TO-DATE
:samples:sample-react-navigation:test UP-TO-DATE
:samples:sample-react-navigation:check UP-TO-DATE
:samples:sample-react-navigation:build
BUILD SUCCESSFUL
Total time: 4 mins 7.267 secs
from kotlin-frontend-plugin.
I see, you have a lot of npm installs. Do you have tests in every module? Most likely you can omit dependencies in sub-modules that you don't run. You generally need npm and webpack only for final bundles (some module that you want to run).
from kotlin-frontend-plugin.
It should be fixed with 0.0.19
from kotlin-frontend-plugin.
Thanks, man!
from kotlin-frontend-plugin.
About what you have written before, when creation libraries I really don't need to create a bundle for it, but I still need the ability to generate the package.json correctly, that's why I used it on every project.
Give a look at my libraries (in maven until now): https://github.com/danfma/kodando. You will see that I have to generate a package for a project to then publish.
I expect that, when I migrate to Gradle and start to use your plugin, I could generate that package.json automatically and get rid of the NPM publishing.
from kotlin-frontend-plugin.
there are two cases: in-project library dependency and external maven library dependency.
When you have in-project library then you probably don't need package.json for library at all because every kotlin2js output file is in resolution paths list so there is no need to have package.json.
If there is a library written in kotlin2js and distributed as jar via maven then it may work without package.json as kotlin-frontend-plugin will generate it as well (as it does for kotlin-stdlib-js for example, you can see it in build/node_modules/kotlin/package.json
- it is generated by the plugin).
So the only usecase is when you need to generate package.json is the case when you are going to publish your library to npm.
from kotlin-frontend-plugin.
Ok, but in the second case, I want to create a binding to an external library (like React) and if I don't specify which library and version I'm using the frontend-plugin won't guess that. Am I wrong?
from kotlin-frontend-plugin.
That's exactly what I'm trying to do! Will you work on this as a feature later? If you do it, then I can migrate to your plugin, but until there, I will have to wait.
:D
from kotlin-frontend-plugin.
Related Issues (20)
- Doesn't handle npm dependencies of dependent project HOT 1
- New MPP: Add example how to run js/karma tests
- Error when using org.jetbrains.kotlin.frontend 0.0.44 with gradle 5.1.1 HOT 3
- HMR not working correctly with Kotlin >= 1.3.20 HOT 2
- webpack.config.d directory should be optional HOT 2
- Missing Gradle plugin ID inhibits usage in kotlin gradle scripts HOT 1
- Error: Cannot find module './build/WebPackHelper.js' HOT 1
- ERROR in Entry module not found: Error: Can't resolve 'new-mpp' in '/Users/clegge/Projects/kotlin-frontend-plugin/examples/new-mpp/build'
- Extension with name 'kotlin' does not exist HOT 3
- JQuery externals producing IOException with version 0.0.45 and gradle 5.2.1
- HMR stops working when using Gradle continuous build HOT 1
- Import a js module for its side effects only HOT 2
- are you not supporting the plugin anymore? HOT 6
- Support create-react-kotlin-app scripts
- Seems to be conflicting with new `kotlin("js")` plugin HOT 2
- Add a KotlinJS JAR as a NPM dependency
- missing org.jetbrains.kotlin.core....jar\bin' HOT 1
- error: Source option 6 is no longer supported. Use 7 or later. HOT 1
- [Error] NpmPackageManager$injectDependencies$1$1 overrides final method getBuildDependencies HOT 5
- build.gradle.kts with sourceSets in android project HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kotlin-frontend-plugin.