I have a problem with adding npm package to Cocos Creator v3.8 project.
I want to add that package because it can be really usefull to read google sheets data in editor time for game configuring.
In process of installation I followed next steps:
1)Installed the package in projects root folder, using npm install --save typescript ts-node @types/node googleapis
command in command prompt.
2)After that, Ive been able to use package code inside of my project scripts - VS Code automatically added import { google } from 'googleapis';
after const auth = new google.auth.JWT
call. But editor started to log an error:
Error: Unresolved specifier ./lib/mappingTable.json
And my script was not working.
3)After googling some info about npm packages problems, I found an advice in that thread on cocos forum about import maps. So I created import-map.json file with next syntax:
{
"imports": {
"googleapis": "./node_modules/googleapis/build/src/"
}
}
and reffered to it in Project Settings/Scripting tab. But now editor logging
[Scene] Error: Error: Directory import is not supported
[Scene] Missing class: ee756oFCtRKa4sg3jxG8FrD
[Scene] Missing class: 06063xe/bRFu6qv9Dplmdk0
and my scripts still dont work.
I`m new in Cocos creator and typescript development - there are a lot of things I may not understand properly. What should I do to make that npm package run properly for my game scripts?