Shubham Singh
10/24/2023, 7:59 AM.js
files are being generated for my project (inside the /Clippy/js/build/compileSync/js/main/developmentExecutable/kotlin
package)
The second attached image shows the content generated for Clippy-js.js
file
Is there a way to just include a single .js
file in the <script>
tag inside my project's index.html
file that automatically imports its required dependencies?
This is how my index.js
file looks like at the moment:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>JS Client</title>
</head>
<body>
<div id="root"></div>
<script src="Clippy-js.js"></script>
</body>
</html>
And this is the error message I see in the console:
Uncaught Error: Error loading module 'Clippy-js'. Its dependency 'react-dom/client' was not found. Please, check whether 'react-dom/client' is loaded prior to 'Clippy-js'.
at Clippy-js.js:8:13
at Clippy-js.js:21:2
Adam S
10/24/2023, 8:45 AM./gradlew projects -q
)Shubham Singh
10/24/2023, 9:05 AM➜ Clippy ./gradlew projects -q
------------------------------------------------------------
Root project 'Clippy'
------------------------------------------------------------
Root project 'Clippy'
+--- Project ':android'
+--- Project ':js'
\--- Project ':shared'
To see a list of the tasks of a project, run gradlew <project-path>:tasks
For example, try running gradlew :android:tasks
Artem Kobzar
10/24/2023, 9:38 AMAdam S
10/24/2023, 9:51 AM:js
subproject contains the index.html then can you try and import a file named js.js
, not Clippy-js.js
?Ilya Goncharov [JB]
10/24/2023, 9:51 AMIlya Goncharov [JB]
10/24/2023, 9:52 AMbrowser
subtarget by default.
It prepares bundle js file which you can just include into your html
pageShubham Singh
10/24/2023, 9:53 AM:js
subproject contains the index.html then can you try and import a file named js.js
, not Clippy-js.js
?
@Adam S It worked 👏 Thanks a lot!
Could you please shed some light on how did you make this conclusion? It doesn't seem very obvious after going through Kotlin/JS' documentation.Adam S
10/24/2023, 9:56 AMShubham Singh
10/24/2023, 9:56 AMjs.js
file in the codebase 🤔Shubham Singh
10/24/2023, 9:57 AMAdam S
10/24/2023, 9:59 AMIlya Goncharov [JB]
10/24/2023, 9:59 AMAlso, I can’t seem to be able to find theIt is generated by webpack. If you run viafile in the codebasejs.js
run
task it is generated only in memory.
If you run assemble
, you can find result in js/build/distributions