Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Time Build Prod] General output time took too much time. #124

Closed
thiensubs opened this issue Jun 26, 2020 · 1 comment
Closed

[Time Build Prod] General output time took too much time. #124

thiensubs opened this issue Jun 26, 2020 · 1 comment

Comments

@thiensubs
Copy link

thiensubs commented Jun 26, 2020

Please help me for my situation:

RAILS_ENV=production NODE_ENV=production ./bin/webpack

Result:

SMP  ⏱
General output time took 11 mins, 25.43 secs

 SMP  ⏱  Plugins
TerserPlugin took 9.82 secs
OptimizeCssAssetsWebpackPlugin took 3.83 secs
CaseSensitivePathsPlugin took 2.078 secs
WebpackAssetsManifest took 0.31 secs
CompressionPlugin took 0.28 secs
VueLoaderPlugin took 0.049 secs
MiniCssExtractPlugin took 0.02 secs
ProvidePlugin took 0 secs
EnvironmentPlugin took 0 secs

 SMP  ⏱  Loaders
babel-loader took 7.017 secs
  module count = 376
mini-css-extract-plugin, and
css-loader, and
postcss-loader, and
sass-loader took 4.47 secs
  module count = 7
css-loader, and
postcss-loader, and
sass-loader took 4.11 secs
  module count = 7
mini-css-extract-plugin, and
css-loader, and
postcss-loader took 3.51 secs
  module count = 8
css-loader, and
postcss-loader took 2.93 secs
  module count = 8
vue-loader took 1.69 secs
  module count = 30
vue-loader, and
babel-loader, and
vue-loader took 1.16 secs
  module count = 20
vue-loader, and
mini-css-extract-plugin, and
css-loader, and
postcss-loader, and
vue-loader took 1.017 secs
  module count = 8
css-loader, and
vue-loader, and
postcss-loader, and
vue-loader took 0.707 secs
  module count = 4
file-loader took 0.391 secs
  module count = 12
modules with no loaders took 0.311 secs
  module count = 7
coffee-loader took 0.097 secs
  module count = 1



Hash: 42cd308bbeb471e393a8
Version: webpack 4.41.6
Time: 685432ms
Built at: 06/27/2020 12:05:41 AM

So what problems and any ideas to help me reduce time for build with Production ENV.

My RoR Webpack config are:

//enviroment.js
const { VueLoaderPlugin } = require('vue-loader')
const vue = require('./loaders/vue')
const erb =  require('./loaders/erb')
const coffee =  require('./loaders/coffee')
const path = require("path")
const svg =  require('./loaders/svg')
const TerserPlugin = require('terser-webpack-plugin');
environment.plugins.append('TerserPlugin', new TerserPlugin({
  terserOptions: {
    optimization: {
      minimize: true,
      minimizer: [
        new TerserPlugin({
          cache: true,
          parallel: 7,
        }),
      ],
    }
  }
}));
environment.loaders.prepend('coffee', coffee)
environment.loaders.prepend('erb', erb)
environment.loaders.prepend('svg', svg)
const webpack = require('webpack')
environment.plugins.prepend('Provide',
  new webpack.ProvidePlugin({
    $: 'jquery',
    jQuery: 'jquery',
    Popper: ['popper.js', 'default'],
    toastr: 'toastr/toastr',
    ApexCharts: ['apexcharts', 'default'],
    underscore: ['underscore', 'm'],
    Rails: ['@rails/ujs']
  })
)
environment.plugins.prepend('VueLoaderPlugin', new VueLoaderPlugin())
environment.loaders.prepend('vue', vue)
const customConfig = require('./custom')
environment.config.merge(customConfig)
environment.loaders.get('sass').use.find(item => item.loader === 'sass-loader').options.includePaths = ['node_modules']

module.exports = environment
//production.js
process.env.NODE_ENV = process.env.NODE_ENV || 'production'

const environment = require('./environment')
const SpeedMeasurePlugin = require('speed-measure-webpack-plugin')
const smp = new SpeedMeasurePlugin()

module.exports = smp.wrap(environment.toWebpackConfig())
// module.exports = environment.toWebpackConfig()
@stephencookdev
Copy link
Owner

stephencookdev commented Jun 29, 2020

Hey @thiensubs

so it's hard to say without looking into the whole project. My guess is that there's a task or something that's taking up a long time here. Possibly something in your customConfig file.

SMP can't track everything that's happening, and I imagine you have some task running that happens to fall outside of what SMP is able to "see".

I'm going to close this issue, though, since it doesn't really sound like this is a bug/issue with this SMP plugin.

I would recommend removing parts of your build process to see what makes the general time suddenly speed up. Sorry to not be more help — hope you can get to the bottom of this 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants