vue-skeleton icon indicating copy to clipboard operation
vue-skeleton copied to clipboard

Use recommended caching settings for awesome-typescript-loader

Open flut1 opened this issue 6 years ago • 6 comments

See: https://github.com/s-panferov/awesome-typescript-loader#performance-issues

These settings should speed up compilation. (we should only enable caching for development)

flut1 avatar Jan 27 '19 14:01 flut1

@hjeti I will take care of this if you like. Do you happen to know why we have node_modules in the "include" array of tsconfig.json? This will most likely slow down compilation a lot. These are the only files you would want in that includes array:

  • The entry point. So in our case that would be bootstrap.ts
  • Any files that aren't explicitly referenced in your code, but that still need to be included for typings. For example: a definitions.d.ts file.

While I don't think that it matters much to include our entire src folder (we probably use all these typings anyway), there are potentially a lot of .ts files in node_modules that are irrelevant to our projects.

flut1 avatar Jan 27 '19 14:01 flut1

I believe WebStorm likes to have the full src/**/*.ts in there to enable project-wide type checking, it doesn't follow imports itself.

ThaNarie avatar Jan 27 '19 15:01 ThaNarie

Yeah I think what I said about the entry point might be true for the files array rather than include. Regardless I agree that we should keep "src/**/*.ts". In my experience it's really annoying if Webstorm doesn't pick up your new TS files unless you import them from somewhere. That does still leave node_modules however, which we should probably remove.

flut1 avatar Jan 28 '19 09:01 flut1

I ran into the following issue on a different project: s-panferov/awesome-typescript-loader#528

Will need to investigate either adding fork-ts-checker plugin like the comments suggest, or maybe look into using ts-loader instead

flut1 avatar Jan 30 '19 14:01 flut1

@flut1 I don't remember why I added the node_modules.

If we are going to move away from awesome-typescript-loader maybe we can use the babel typescript preset in combination with the fork-ts-checker-webpack-plugin. I don't know how stable it is but it is used in create-react-app.

hjeti avatar Jan 31 '19 14:01 hjeti

I think I'll have to try both ts-loader, awesome-typescript-loader and babel-typescript in 1 or more projects to see which is fastest. I'll do some benchmarks and will let you know. Additional caching like hard-source-cache-loader seems to make a huge difference in all 3 of these.

flut1 avatar Jan 31 '19 14:01 flut1