doberkofler
doberkofler

Reputation: 10421

webpack2 production build really slow "additional asset processing"

I have a large webpack build that almost hangs at 91% on an "additional asset processing" step that does not give me a lot more information. Just this step consumes up to 4 minutes and seems to grow almost exponentially as we add modules to the build. Is there a way to better understand what is done during this step and eventually optimize it?

56205ms building modules
31ms sealing
0ms optimizing
0ms basic module optimization
15ms module optimization
0ms advanced module optimization
0ms basic chunk optimization
0ms chunk optimization
16ms advanced chunk optimization
14487ms building modules
0ms module and chunk tree optimization
31ms module reviving
0ms module order optimization
16ms module id optimization
0ms chunk reviving
16ms chunk order optimization
31ms chunk id optimization
140ms hashing
0ms module assets processing
265ms chunk assets processing
0ms additional chunk assets processing
0ms recording
206740ms additional asset processing
79781ms chunk asset optimization
1ms asset optimization
906ms emitting

Upvotes: 7

Views: 3632

Answers (2)

Philip
Philip

Reputation: 3536

In my case it was the webpack babili plugin (now babel-minify-webpack-plugin). I've replace it with uglifyjs-webpack-plugin.

My config:

new UglifyJSPlugin({
  parallel: true,
  exclude: /\/node_modules/,
  uglifyOptions: {
    ecma: 8,
    mangle: true,
    compress: {
      sequences: true,
      dead_code: true,
      conditionals: true,
      booleans: true,
      unused: true,
      if_return: true,
      join_vars: true,
      drop_console: true
    },
    output: {
      comments: false,
      beautify: false
    }
  }
})

Upvotes: 0

ceebreenk
ceebreenk

Reputation: 1029

Not sure what your setup is but in my case it was Webpack and Extract Text plugin that was causing long asset load times. I changed to Webpack 2.7.0 and extract-text-webpack-plugin 2.1.2 and loading was back to normal.

Upvotes: 1

Related Questions