Hi @slackmoehrle @zzf_Cocos ,
My requirement is to create a custom component say :
import { _decorator, Component } from 'cc';
const { ccclass, property} = _decorator;
@ccclass('GameScene')
export class GameScene extends Component {
load () {
}
start () {
console.log("GameScene: start called");
}
}
I am able to compile above code as a library following this link:
how-to-write-a-typescript-library
to compile it successfully I have to use following configuration in tsconfig.json :
{
"compilerOptions": {
"skipLibCheck": true,
"module": "commonjs",
"target": "es2015",
"declaration": true,
"outDir": "./dist",
"noImplicitAny": false,
"strict": false,
"paths": {
"cc": ["./temp/declarations/cc"],
"cc/env" : ["./temp/declarations/cc.env"]
},
"experimentalDecorators": true
},
"types": [
"./temp/declarations/cc.env",
"./temp/declarations/jsb",
"./temp/declarations/cc"
],
"isolatedModules": true,
"moduleResolution": "node",
"include": [
"src/**/*"
],
"exclude": ["node_modules","temp"]
}
Now when using this package in some other project, I am not able to attach this component to a node.
It gives error
[Scene] Unresolved specifier cc
cc module is not getting register for this package.
checked modules.json at location
temp/programming/packer-driver/targets/editor/modules.json
resolvedImports value is null for cc for custom component
So question is how to create a typescript library having cc module as dependency. So that it can be used across projects.
Thanks,
Rahul