-
-
Notifications
You must be signed in to change notification settings - Fork 143
Conversation
- exclude plotly.js from sourcemap - exclude plotly.js from parsing
externals, | ||
module: { | ||
noParse: /node_modules\/plotly.js/, |
There was a problem hiding this comment.
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', |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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'] |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💃
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.