Skip to content

Speed issues #181

@olmobrutall

Description

@olmobrutall

Hi @jbrantly and company,

I've been struggling recently improving the build time of a mid-big application using typescript + react + webpack.

This are my main dependencies:

module.exports = {
    entry: {
        //main: [ "./Scripts/Main.tsx" ],
        "react": ["react", "react-bootstrap", "react-router", "react-widgets", "react-router-bootstrap", "moment", "numbro"],
        "codemirror": ["codemirror"],
        "d3": ["d3"],
    },
    ....
}
  1. With main commented-out webpack takes only 3.9s to compile the dependencies.
  2. Running tsc --outFile takes 6s to compile and bundle my code.
  3. So I was expecting ts-loader and ts-loader to take about 10s.

Unfortunately It takes between 30s and 40s, 3 or 4 times slower than expected.

I've tried different possibilities,

  • like using externals and noParse-> no important changes
  • stop using CommonsChunkPlugin-> no important changes.
  • using new webpack.optimize.LimitChunkCountPlugin({maxChunks: 15}) -> about 8% slower.
  • removing all the async requires and make one big bundle, without code splitting -> about 10% faster.
  • using awesome-typescript-loader instead of ts-loader -> about 10% faster.
  • finally using 'ts-loader` with transpileOnly -> about 80% faster now it takes some reasonable * 12s*

But of course this is cheating since ts-loader is not doing the same work than tsc was doing.

For now I will settle on this solution, since I'm compiling TS with noEmit on VisualStudio anyway (I prefer to get the errors there, so I can double-click on them), but I'm curious why webpack is fast, typescript is fast, but webpack + typescript is four times slower :S

I repeated all the measures twice

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions