-
Notifications
You must be signed in to change notification settings - Fork 14k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build: optimize frontend build configs to improve superset-ui-plugin dev experience #9326
Conversation
Codecov Report
@@ Coverage Diff @@
## master #9326 +/- ##
==========================================
- Coverage 59.33% 58.79% -0.54%
==========================================
Files 374 374
Lines 12202 12108 -94
Branches 2880 2984 +104
==========================================
- Hits 7240 7119 -121
+ Misses 4962 4810 -152
- Partials 0 179 +179
Continue to review full report at Codecov.
|
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.
a couple comments. also, could you specify some other manual testing you did? i want to make sure sql lab, dashboards, and explore all still work fine since this is a substantial frontend change. maybe also validate CRUD views work as they have different entry points from the rest of the app
I just clicked on all the major pages (including some CRUD views) and made sure they didn't throw JS error. Did the same for production build with |
Also remove babel-plugin-css-modules-transform that is not in use.
Spent some time today testing this locally, and it seems to be working out great! Thank you for this work, I look forward to it being in master and using it day to day. One question (perhaps a bit of a tangent): Do we still need to point to NVD3's Regarding your hot loading limitation, I did see some symptoms of it, but suspect it's just that D3 doesn't redraw on hot-reload unless something triggers in the the D3's data, triggering it lifecycle to run. For example, I tested an edit to the Big Number component, turning the actual number to "hello" and it appears the hot-loading didn't run, but when you mouseover the chart, D3 is triggered to update. When doing a similar test with Treemap, there are no interactions that seem to "kick" D3 into action, so the change doesn't appear, and you need to refresh. I didn't see any cases where editing/saving Copying some of your helpful instructions/comments from the Summary into Again, thanks for this, it's great work! |
Thanks for testing, @rusackas ! I'm mostly seeing this with |
If it is working then we don't need |
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.
Code LGTM. I also tested dashboards, explore, and sql lab, with and without symlinks, on my local machine and everything seems to work correctly as far as I can tell.
This is a big improvement, thanks!
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.
I think this is SUPER useful as-is, even if a couple follow-up PRs might be in the works to tie up loose ends mentioned elsewhere above. Just needs docs, and I'd give it the green light.
In that case, since the CI is now green, feel free to merge it as is. I'll make another PR to update docs and possibly tune the configs even more. |
OMG OMG OMG! thanks much @ktmud |
CATEGORY
SUMMARY
This PR optimizes Webpack / Babel / TypeScript configs to make local build with
webpack-dev-server
andnpm link
less error-prone. It fixes tones of potential pitfalls that are currently breaking the build process. See details in code comments.Building with source code (including TypeScript) should now work for most visualization plugins out of the box with a simple
npm link
command (all official plugins have been tested working):The dev server will automatically use
./node_modules/@superset-ui/plugin-name/src
to resolveimport "@superset-ui/plugin-name"
, if thesrc
folder exists (normally only when the npm package@superset-ui/plugin-name
is linked to the source code repo vianpm link
).To link all plugins, just do:
To unlink, just run
npm install
again. Relinking is as simple as hittingCtr + R
in Bash/ZSH:Note this PR also solves some of the problems mentioned in #8638 (e.g., to eliminate the need to manually edit plugin path in
MainPreset.js
by automatically resolving symlinked plugin packages to<plugin-name>/src
).Limitation
There is still some issues with the process that is preventing hot-reload to work on Chart plugins (probably a bug or misconfiguration related to react-hot-loader or how
Superchart
renders aviz_type
dynamically). The code will successfully build, but the visualization will not rerender (still can't figure out why...). The remedy is to edit superset-frontend/src/chart/Chart.jsx after editing the plugin.This PR also upgrades following packages:
I figure it's just easier to upgrade everything to the latest version other than chasing down a potential bug that may have been fixed in later versions.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
When running
npm run dev-server
, there will be a notice on which plugins are now using symlink to its source.TEST PLAN
npm link
a plugin, either by the commands presented above or follow the instruction here. Make sure you have runyarn && yarn build
in the plugin repo after checking it out.npm run dev-server
packages/plugin-name/src
.ADDITIONAL INFORMATION
REVIEWERS
@suddjian @rusackas @kristw @etr2460