DEV Community

Discussion on: Electron with Typescript using ts-node

Collapse
 
michaeljota profile image
Michael De Abreu

For building you should consider use Webpack or similar to bundle your code. ts-node it's great for development, but it wasn't made for production environments.

Collapse
 
trusktr profile image
Joe Pea

Ts-node is working great in production. The application startup speed difference is totally imperceivable (and we have quite a bit of code!). The nice thing is that imports compile to native Node.js require() calls, which is much more flexible than with Webpack. The file path you specify is actually what you're working with, which is valuable. We can do nice runtime tricks with the imports (requires) that are otherwise difficult to do with Webpack. It's nice to be able to work with the actual underlying system that way.

Thread Thread
 
michaeljota profile image
Michael De Abreu

For node_modules requires, you can use npmjs.com/package/Webpack-node-ext.... I would really consider use Webpack, but it seems it's safe to use ts-node (github.com/TypeStrong/ts-node/issu...).

Thread Thread
 
trusktr profile image
Joe Pea

Ah, thanks for sharing webpack-node-externals. That could come handy when I find myself in an existing webpack/node project.

Thread Thread
 
marksyzm profile image
Mark Elphinstone-Hoadley

Did you manage to get debugging to work in vscode or similar? I've had problems getting breakpoints to work. It just ignores them when it is in a file that isn't native JS.