-
-
Notifications
You must be signed in to change notification settings - Fork 434
Closed
Description
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"],
},
....
}- With
maincommented-out webpack takes only 3.9s to compile the dependencies. - Running
tsc --outFiletakes 6s to compile and bundle my code. - So I was expecting
ts-loaderandts-loaderto take about 10s.
Unfortunately It takes between 30s and 40s, 3 or 4 times slower than expected.
I've tried different possibilities,
- like using
externalsandnoParse-> 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-loaderinstead ofts-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
nascosto, mpetito, H4rryp0tt3r and WouterBant
Metadata
Metadata
Assignees
Labels
No labels
