I just noticed something and would like to understand why node behaves in this way.
I have 2 files like so:
src/api/index-api.ts
src/worker/index-worker.ts
They both have a simple console.log('Started xxx')
What I noticed was when I ran node build/api/index-api.js - I see both Started API and Started Worker in the console.
I figured out that in src/api/index-api.ts there is an import statement to use a function from src/api/index-worker.ts:
import { getContentFunction } from '../worker';
So I can see why they both get called.
But what exactly is the actual working of this - I mean what exactly happens and why is this so? As far as I was aware I'm just importing a specific function.
Thanks.