How do you enable --profile option as described in this doc http://webpack.github.io/docs/build-performance.html#hints-from-build-stats
I'd like to improve my build by reducing time
Hi @mstrom,
If you want the profiling stats to be displayed in your console you'll need to modify the generated webpack config manually since Encore silences most outputs:
// webpack.config.js
const Encore = require('@symfony/webpack-encore');
Encore
.setOutputPath('build/')
.setPublicPath('/')
// (...)
;
// Generate the config
const config = Encore.getWebpackConfig();
// Use default `stats` options
delete config.stats;
// Export the config (do NOT call `getWebpackConfig()` again)
module.exports = config;
You should then be able to call yarn run encore production --profile.
Now, if you want to use these stats in profiling tools you'll also need the --json option. That one won't work right now because of another issue (see #204) but that should be fixed once #215 is merged.
Anyway, maybe we should also fallback to the default stats options when Encore is called with the --profile option though, WDYT @weaverryan?
@Lyrkan I think detecting the --profile option makes sense.
Hmm, yea, makes sense.
Most helpful comment
Hi @mstrom,
If you want the profiling stats to be displayed in your console you'll need to modify the generated webpack config manually since Encore silences most outputs:
You should then be able to call
yarn run encore production --profile.Now, if you want to use these stats in profiling tools you'll also need the
--jsonoption. That one won't work right now because of another issue (see #204) but that should be fixed once #215 is merged.Anyway, maybe we should also fallback to the default
statsoptions when Encore is called with the--profileoption though, WDYT @weaverryan?