-
-
Notifications
You must be signed in to change notification settings - Fork 146
Allow projects to use dcc source directly #723
Conversation
…rojects (automate on publish) - update LazyLoader to allow for tree-shaking - declare the project side-effect-free
@@ -12,6 +12,7 @@ | |||
"homepage": "https://github.com/plotly/dash-core-components", | |||
"main": "dash_core_components/dash_core_components.min.js", | |||
"scripts": { | |||
"prepublishOnly": "rm -rf lib && babel src --out-dir lib --copy-files", |
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.
On prepublish, transpile all source to /lib
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.
Include the css files too! :)
@@ -48,9 +49,11 @@ | |||
"react-markdown": "^4.0.6", | |||
"react-select-fast-filter-options": "^0.2.3", | |||
"react-virtualized-select": "^3.1.3", | |||
"react-resize-detector": "^4.2.1", |
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.
Required for 3rd party build inclusion
"uniqid": "^5.0.3" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.4.0", |
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.
Allows using babel
from the command line
@@ -88,8 +90,10 @@ | |||
"webpack-serve": "^2.0.3" | |||
}, | |||
"files": [ | |||
"/dash_core_components/*{.js,.map}" | |||
"/dash_core_components/*{.js,.map}", | |||
"/lib/**" |
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.
Include in the published package
@@ -112,7 +112,7 @@ module.exports = (env, argv) => { | |||
plugins: [ | |||
new WebpackDashDynamicImport(), | |||
new webpack.SourceMapDevToolPlugin({ | |||
filename: '[name].js.map', | |||
filename: '[file].map', |
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.
caused the entrypoint sourcemap to be main.js.map
instead of dash_core_components.min.js.map
import(/* webpackChunkName: "plotlyjs" */ 'plotly.js').then(({ default: Plotly }) => { | ||
window.Plotly = Plotly; | ||
return Plotly; | ||
})); |
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.
Splitting it all up for tree shaking reasons..
@@ -0,0 +1,6 @@ | |||
export default () => Promise.resolve(window.Plotly || |
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.
While we're here, might be interesting to check if window.Plotly.version
matches our expected minimal version?, and if not, force loading the one in our bundle.. this will also be useful to protect against old versions of dash-bio dumping an old version of Plotly.js for DCC to use.
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.
LGTM! 💃
deps
vsdevDeps
for source usage