Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Issue 688 - Speed up build for DCC #716

Merged
merged 2 commits into from
Dec 13, 2019
Merged

Issue 688 - Speed up build for DCC #716

merged 2 commits into from
Dec 13, 2019

Conversation

Marc-Andre-Rivet
Copy link
Contributor

@Marc-Andre-Rivet Marc-Andre-Rivet commented Dec 13, 2019

Fixes #688

On my local machine, build time for DCC goes from ~5 minutes down to ~45 seconds for a no-cache rebuild and ~18 seconds for a "with cache" rebuild.

From the perspective of a DCC user or developer, having access to the Plotly.js sourcemap is of little practical value in most scenarios.

- exclude plotly.js from sourcemap
- exclude plotly.js from parsing
externals,
module: {
noParse: /node_modules\/plotly.js/,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We know the output of Plotly.js is (1) valid, (2) self-contained (doesn't it to resolve outward facing define/import/require), so don't parse it, just take the file as-is.

new TerserPlugin({
sourceMap: true,
parallel: true,
cache: './.build_cache/terser',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two things matter here: (1) the cache folder, (2) source mapping in the minimizer, this allows the devtool plugin to override which chunk will get mapped (vs. devtools prop)

@@ -52,9 +52,9 @@ module.exports = (env, argv) => {
library: dashLibraryName,
libraryTarget: 'window',
},
devtool,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now handled by the minimizer. Makes it possible to exclude chunks from mapping

new WebpackDashDynamicImport(),
new webpack.SourceMapDevToolPlugin({
filename: '[name].js.map',
exclude: ['async~plotlyjs']
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

source mapping plotlyjs accounted for the majority of the build time (15s to build + 30s to map non-plotlyjs chunks + 30s to parse plotlyjs + 3.5mn to map plotlyjs)

Copy link
Contributor

@shammamah-zz shammamah-zz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💃

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

Successfully merging this pull request may close these issues.

dcc package takes too long to build
2 participants