Server vs Client live rebuild/refresh problem

Hello, just to understand how Meteor detects when a client-side script or a server-side script has been updated, because in my project it detects only client-side script updates even when scripts are imported from main.ts inside the server folder.

I’m facing this problem: I’ve started a project using latest version of Meteor(1.10.1) and added Angular 9 and Typescript support using meteor-typescript, the problem is that any time i change a ts script that is imported or not from a server folder, the change is detected as a client-side update so server doesn’t restart and i got a browser refresh instead.
I don’t know whether it could depends on angular-meteor package or is just a bug with typescript compilation.

I hope the problem is easy to understand. Any help/suggestion is really appreciated!

What folder is the imported script in?

I believe your imports should be in the imports folder, or you’ll have issues with live reloading reloading the wrong things.

Hello, first thank you for the answer.
Of course server-side scripts are inside the imports folder and they are imported from server/main.ts.
I’ve even tried to put them inside a sub-folder server inside imports(ex: imports/server/myscripts.ts) and doing that Meteor stopped detecting changes for that script.

At the moment, to force a server-side rebuild/restart, i’ve to update the server/main.ts. It’s the only script that is detected as a server-side script.

I’ve digged it a bit more using a local package folder for angular-compilers and found the function processFilesForTarget called by Meteor at any script updated, that receives input files with web architecture even for server-side scripts updates, so i think the problem is at Meteor core level, but i could be wrong…

You mentioned you were using meteor-typescript - is that meteor add typescript?

That would be the official typescript implementation. I know other implementations existed before there was an official one.

Does your package.json include your server/client entry points as well?

Yes, i’ve mainModule specified in my package.json with client/main.ts and server/main.ts.

meteor-typescript is a inner dependency of angular-compilers that i need to use because i work with Angular 9.

Angular compilers package has inside 3 further modules, one for typescript compiling(meteor-typescript), one for html templates and one for scss.

I’ve tried to use default typescript from Meteor repository but it doesn’t work as i aspected, i have many problems with imports, i think meteor-typescript is doing something more or different.

Could be related to this

Yes, it’s the same problem as mine. I’ve missed the changelog as i’ve updated Meteor from an older version directly to the new one. The problem is that imports folder now is not mandatory anymore when you want to play with eager/lazy loading just use the mainModule as you suggested previously. Thank you!