Alex Edwards
11/02/2021, 4:41 PMpackage.json
file for a project with binaries.executable()
?
i’ve looked at the file in myproject/build/tmp/jsPublicPackageJson
and the one in build/js/packages/myproject
and they are both missing packages from the dependency section that the generated js file has as require.
If i go and look at the projects that pull in these dependencies directly their package.json
files look as i would expect them to. This seems essentially the same as https://youtrack.jetbrains.com/issue/KT-45789Big Chungus
11/02/2021, 4:53 PMAlex Edwards
11/02/2021, 5:09 PMmyproject/build/productionLibrary/
but the package.json file has not changed its still missing the transitive dependenciesBig Chungus
11/02/2021, 5:11 PMBig Chungus
11/02/2021, 5:14 PMAlex Edwards
11/02/2021, 5:17 PM}(module.exports, require('@aws-sdk/config-resolver'), require('@aws-sdk/client-cognito-identity-provider'), require('@aws-sdk/client-kms'), require('@js-joda/core')));
but the package.json is
{
"name": "myproject",
"version": "0.0.1",
"main": "myproject.js",
"types": "myproject.d.ts",
"devDependencies": {},
"dependencies": {},
"peerDependencies": {},
"optionalDependencies": {},
"bundledDependencies": []
}
all of those require
are coming transitively from kotlin dependencies. So in my project I have implementation("dep1:2.0.0")
but if we look at build/js/packages_imported/dep1/2.0.0/package.json
it has the correct dependency
{
"name": "dep1",
"version": "2.0.0",
"main": "dep1.js",
"types": "dep1.d.ts",
"devDependencies": {},
"dependencies": {
"@aws-sdk/client-cognito-identity-provider": "3.34.0"
},
"peerDependencies": {},
"optionalDependencies": {},
"bundledDependencies": []
}
Big Chungus
11/02/2021, 5:19 PMBig Chungus
11/02/2021, 5:20 PMAlex Edwards
11/02/2021, 5:21 PMnode_modules
with all the project dependencies in itAlex Edwards
11/02/2021, 5:21 PMHmm, did you try using that executable at all? Kjs compiler might be embedding them into a final js output.So the compiler can put multiple modules in the same file?
Big Chungus
11/02/2021, 5:24 PMAlex Edwards
11/02/2021, 6:14 PMAlex Edwards
11/02/2021, 6:14 PMAlex Edwards
11/02/2021, 6:15 PM./gradlew build
then do node app.js
it works fineAlex Edwards
11/02/2021, 6:15 PMAlex Edwards
11/02/2021, 6:16 PMrequire
in my app.js file to match that new file location it breaks because the dependency is missingAlex Edwards
11/02/2021, 6:31 PMshaktiman_droid
11/02/2021, 6:57 PMrequireJs
. Please share more of your findings here regarding what's possible and what's not when including npm
dependency on kotlin/js
sideBig Chungus
11/02/2021, 8:26 PMAlex Edwards
11/02/2021, 8:31 PMBig Chungus
11/02/2021, 9:30 PMBig Chungus
11/02/2021, 9:30 PMandylamax
11/03/2021, 6:15 AMBig Chungus
06/29/2022, 12:07 PM