esbuild-node-tsc icon indicating copy to clipboard operation
esbuild-node-tsc copied to clipboard

Incremental builds

Open ekeuus opened this issue 4 years ago • 6 comments

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.

ekeuus avatar Apr 28 '21 10:04 ekeuus

Yep sounds good. Can you give it a try ?

a7ul avatar Apr 28 '21 12:04 a7ul

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.

ekeuus avatar May 01 '21 10:05 ekeuus

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.

Sytten avatar Oct 19 '21 15:10 Sytten

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.

ekeuus avatar Oct 19 '21 16:10 ekeuus

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?

Sytten avatar Oct 19 '21 16:10 Sytten

``> 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'],
	},
};

ekeuus avatar Oct 19 '21 21:10 ekeuus