esbuild-node-tsc
esbuild-node-tsc copied to clipboard
Incremental builds
Would it be possible to extend this to have incremental builds using nodemon? Our full dev build using etsc takes about 15s and if incremental could improve it somehow, I'd be willing to implement it. I currently see no such flag is in the config.
Yep sounds good. Can you give it a try ?
I started work on it a bit and actually have a first working version here - https://github.com/fizure/esbuild-node-tsc/commit/0e3d4075431e4be5bb821652b252678c3a8294d6. The problem is, however that we'd still need to restart the script somehow so I am not sure if the complexity is worth it.
Why it is not worth it - when I added more logging in the code I found that my combination of basedir '.' and filePatterns: ["**/*.json"] ended up also copying assets from node_modules, which took at least 5 seconds (up to 20). The build itself only took some hundred ms. When only assets from the src folder are copied, the build time is around 2 sec on a very large project so I am not sure if the watch mode, proposed in the commit above, adds value.
I am working on a quite large project and the build is pretty slow (10-15s), I don't think I copy files from the node modules. So I think it would still be worth it to have incremental compilation.
I am working on a quite large project and the build is pretty slow (10-15s), I don't think I copy files from the node modules. So I think it would still be worth it to have incremental compilation.
Just check that your config is correct and that node_modules is ignored. If you've done that, then it should perform nicely.
If I have:
"compilerOptions": {
"sourceMap": true,
"esModuleInterop": true,
"lib": ["ES2020"],
"target": "ES2019",
"module": "CommonJS",
"outDir": "./dist",
"baseUrl": "./",
"paths": {
"~/*": ["src/*"]
}
},
"include": ["src/**/*"]
Does that ignore the node_modules, or does it still copy it and just not compile it?
``> If I have:
"compilerOptions": { "sourceMap": true, "esModuleInterop": true, "lib": ["ES2020"], "target": "ES2019", "module": "CommonJS", "outDir": "./dist", "baseUrl": "./", "paths": { "~/*": ["src/*"] } }, "include": ["src/**/*"]Does that ignore the node_modules, or does it still copy it and just not compile it?
Can be, since we had to define this etsc config file to make it work correctly:
module.exports = {
outDir: './dist',
esbuild: {
minify: false,
target: 'es6',
},
assets: {
baseDir: '.',
filePatterns: ['src/**/*.json', 'src/**/*.xlsx', 'src/**/*.pdf', 'src/**/*.jpeg'],
},
};