-
-
Notifications
You must be signed in to change notification settings - Fork 74
Handle external 'prop-types' correctly in prod build #488
Conversation
root: 'ReactDOM' | ||
}, | ||
react: 'React', | ||
'react-dom': 'ReactDOM', |
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.
This can be simplified as it's target is window
now
}, | ||
mode: mode, | ||
output: { | ||
path: path.resolve(__dirname, `./../../${dashLibraryName}`), | ||
filename: '[name].js', | ||
library: dashLibraryName, | ||
libraryTarget: 'umd' | ||
libraryTarget: 'window' |
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.
Loaded unto window.dash_table
in the browser
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.
Will changing how this is exposed have any side-effects for non-Dash users? Could you imagine anyone using RequireJS or anything else that expects a umd
in their JavaScript project? I suppose, obviously, we wouldn't expect Node.js users (without a window
global namespace) to be using this project. I'm also not sure if there's any webpack magic that makes this a non-issue.
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.
This should not have an impact.
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.
Thanks! I believe this will fix "issues" like this right?
LGTM overall but I'd like some clarification on the libraryTarget
below if you could shed some light on my webpack understanding!
}, | ||
mode: mode, | ||
output: { | ||
path: path.resolve(__dirname, `./../../${dashLibraryName}`), | ||
filename: '[name].js', | ||
library: dashLibraryName, | ||
libraryTarget: 'umd' | ||
libraryTarget: 'window' |
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.
Will changing how this is exposed have any side-effects for non-Dash users? Could you imagine anyone using RequireJS or anything else that expects a umd
in their JavaScript project? I suppose, obviously, we wouldn't expect Node.js users (without a window
global namespace) to be using this project. I'm also not sure if there's any webpack magic that makes this a non-issue.
@wbrgss Yes. It will fix the missing prop types dep |
Adding a changelog entry and will merge afterwards. |
This PR correctly externalizes
prop-types
for usage as a library. It also exposes the library as a prop onwindow
to be consistent with other Dash libraries.Would normally not update the build as part of a PR but this is included in another project through package.json and makes everything easier to handle on the other end.
"dash-table": "github:plotly/dash-table#prod-prop-types"