Typescript export/import causing build errors

I built my first actor today using the Typescript/Crawlee/Cheerio template. I’m a front end developer that uses Typescript every day, so this felt comfortable at first. I quickly ran into build problems though. I split my code into multiple files that exported functions and some types, however the build failed as it did not like my imports into main.ts. No matter how I tried to import my helper functions I would get linting and build errors. I ended up copy pasting my code into main.ts, which did work, but this seems unnecessary. What is the correct approach to splitting my code so that I can import into main.ts?
2 Replies
xenial-black
xenial-black16mo ago
Hey @rob_whufc, our team will reply to you soon.
afraid-scarlet
afraid-scarlet15mo ago
@rob_whufc Can you please provide some reproduction? Code on the Apify platform would be the best. Also, try to use ready templates: https://docs.apify.com/platform/actors/development/quick-start/locally#2-create-your-actor It has some basic structure with ready modules and there shouldn't be any issues with creating new modules / separate files.

Did you find this page helpful?