You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/10/12 03:03:28 UTC

[GitHub] [superset] codyml opened a new pull request, #21779: fix(plugin-chart-handlebars): Update webpack/babel config to fix build/runtime warnings/errors

codyml opened a new pull request, #21779:
URL: https://github.com/apache/superset/pull/21779

   <!---
   Please write the PR title following the conventions at https://www.conventionalcommits.org/en/v1.0.0/
   Example:
   fix(dashboard): load charts correctly
   -->
   
   ### SUMMARY
   <!--- Describe the change below, including rationale and design decisions -->
   
   This PR is an attempt to fix the Handlebars viz plugin, which currently raises both build and runtime errors, by updating Webpack and Babel config.
   
   #### Build warning
   Webpack would emit the following warning several times during build: `require.extensions is not supported by webpack. Use a loader instead.`.  The source listed was various lines in `./node_modules/handlebars/lib/index.js`.  According to the Handlebars GH project, this is due to the package not correctly indicating which build is client-side-compatible.  A [fix](https://github.com/handlebars-lang/handlebars.js/pull/1862) was merged, but it hasn't made it into an NPM-published release.  A workaround was recommended by [this comment](https://github.com/handlebars-lang/handlebars.js/issues/953#issuecomment-239874313) and is included in this PR.  This issue doesn't seem to be related to the runtime error and this fix just clears the build warning.
   
   #### Runtime error
   When rendering a Handlebars chart in Explore, the following error appears: `ReferenceError: exports is not defined`.  An inspection of the console shows that the culprit is the `just-handlebars-helpers` package's references to `exports`, as is standard in the CJS module system.  After some digging, I found [this comment](https://github.com/webpack/webpack/issues/4039#issuecomment-419284940) that makes me think the problem is a CJS/ESM incompatibility: our Babel setup assumes all JS is ESM-style modules and therefore doesn't transpile CJS-style `require` and `module.exports` statements into `import`/`export` statements, and Webpack assumes Babel output is ESM-style modules and doesn't provide global `require`/`module.exports` that you'd find in a CJS environment, causing this error (`just-handlebars-helpers` seems to be CJS-only).  As suggested by the comment, I changed `sourceType` to `unambiguous` so it stops assuming modules are ESM-style and instead makes a guess based on the p
 resence of `require`/`module.exports`.  This seems to fix the issue, though I don't have a great sense of what else this might affect.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   <!--- Skip this if not applicable -->
   
   Before:
   
   <img width="638" alt="Screen Shot 2022-10-11 at 8 59 13 PM" src="https://user-images.githubusercontent.com/13007381/195239857-bcf58122-033f-4ef2-aeaf-78cee419efb1.png">
   
   <img width="897" alt="Screen Shot 2022-10-11 at 8 59 24 PM" src="https://user-images.githubusercontent.com/13007381/195239878-7803d2ef-80ca-4a5a-9226-8a1d1ecf848c.png">
   
   After:
   
   <img width="638" alt="Screen Shot 2022-10-11 at 9 00 27 PM" src="https://user-images.githubusercontent.com/13007381/195239925-9b694af4-9e52-468d-867b-32a070a9a370.png">
   
   <img width="895" alt="Screen Shot 2022-10-11 at 9 00 35 PM" src="https://user-images.githubusercontent.com/13007381/195239937-e19fb700-19fe-4ec3-84dc-1934aac3bed5.png">
   
   ### TESTING INSTRUCTIONS
   <!--- Required! What steps can be taken to manually verify the changes? -->
   - Run webpack and ensure the aforementioned build warnings are gone.
   - Try creating a Handlebars chart and ensure the runtime error doesn't show up.
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] codyml commented on pull request #21779: fix(plugin-chart-handlebars): Update webpack/babel config to fix build/runtime warnings/errors

Posted by GitBox <gi...@apache.org>.
codyml commented on PR #21779:
URL: https://github.com/apache/superset/pull/21779#issuecomment-1276846415

   @zhaoyongjie @villebro @rusackas If it helps, I just pushed a diff that overrides the Babel `sourceType` for just the package in question rather than the whole project.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] sadpandajoe commented on pull request #21779: fix(plugin-chart-handlebars): Update webpack/babel config to fix build/runtime warnings/errors

Posted by GitBox <gi...@apache.org>.
sadpandajoe commented on PR #21779:
URL: https://github.com/apache/superset/pull/21779#issuecomment-1279205932

   🏷️ preset:2022.41


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] rusackas merged pull request #21779: fix(plugin-chart-handlebars): Update webpack/babel config to fix build/runtime warnings/errors

Posted by GitBox <gi...@apache.org>.
rusackas merged PR #21779:
URL: https://github.com/apache/superset/pull/21779


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] rusackas commented on pull request #21779: fix(plugin-chart-handlebars): Update webpack/babel config to fix build/runtime warnings/errors

Posted by GitBox <gi...@apache.org>.
rusackas commented on PR #21779:
URL: https://github.com/apache/superset/pull/21779#issuecomment-1276713694

   Heya @zhaoyongjie / @villebro 
   
   It's true, I don't like the idea of copying over all the internals of that helper module into our codebase for a couple of reasons:
   1) It feels "gross" from a copyright/licensing/plagiarism perspective
   2) We would lose the benefit of any updates/expansions that the other project takes on.
   
   So, I'd _like_ to use this `just-handlebars-helpers` module if possible. I'm also open to competitors, but nothing obvious turns up except for [this one](https://github.com/assemble/handlebars-helpers) which seems unmaintained.
   
   I'll open up an Issue on the `just-handlebars-helpers` repo to see if they would be willing to create an EJS version. Otherwise, if we can change the babel config for a specific file path, that'd be a little more surgical than this PR currently is.
   
   However, the big question I have is: do we see any realistic risk or downslides to this change in babel config? Maybe we can approve/merge this until the day that `just-handlebars-helpers` adds EJS (maybe we write a PR there!) at which point we can lock this back down.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] zhaoyongjie commented on pull request #21779: fix(plugin-chart-handlebars): Update webpack/babel config to fix build/runtime warnings/errors

Posted by GitBox <gi...@apache.org>.
zhaoyongjie commented on PR #21779:
URL: https://github.com/apache/superset/pull/21779#issuecomment-1275694082

   @codyml When I looked into the dependency that [Just Handlebars Helpers](https://www.npmjs.com/package/just-handlebars-helpers), it said that *A lightweight package with common [Handlebars](https://github.com/wycats/handlebars.js) helpers.* from the npm registry description. It just provided some shortcuts for the `Handlebars`, so it's not a core function for the Handlebar. This plugin was introduced from [PR](https://github.com/apache/superset/pull/20648).
   
   IMO, I would rather remove the `Helper` than change the global Bable setting to fit a plugin's configuration.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] villebro commented on pull request #21779: fix(plugin-chart-handlebars): Update webpack/babel config to fix build/runtime warnings/errors

Posted by GitBox <gi...@apache.org>.
villebro commented on PR #21779:
URL: https://github.com/apache/superset/pull/21779#issuecomment-1275985732

   > @codyml When I looked into the dependency that [Just Handlebars Helpers](https://www.npmjs.com/package/just-handlebars-helpers), it said that _A lightweight package with common [Handlebars](https://github.com/wycats/handlebars.js) helpers._ from the npm registry description. It just provided some shortcuts for the `Handlebars`, so it's not a core function for the Handlebar. This plugin was introduced from [PR](https://github.com/apache/superset/pull/20648).
   > 
   > IMO, I would rather remove the `Helper` than change the global Bable setting to fit a plugin's configuration.
   > 
   > What do you think about this? @evans @villebro
   
   I believe there's actually an open PR out there to do exactly this: #21143 (the discussion there is pretty similar to what you're proposing). I think this comes down to whether or not we feel maintaining these helpers ourselves is something we want to do or not. Normally I'd say let's just use the npm package, but if using the upstream package requires us to do hacky workarounds, then I'm not so sure.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] rusackas commented on pull request #21779: fix(plugin-chart-handlebars): Update webpack/babel config to fix build/runtime warnings/errors

Posted by GitBox <gi...@apache.org>.
rusackas commented on PR #21779:
URL: https://github.com/apache/superset/pull/21779#issuecomment-1276978684

   > @zhaoyongjie @villebro @rusackas If it helps, I just pushed a diff that overrides the Babel `sourceType` for just the package in question rather than the whole project!
   
   Thanks! We spent a few minutes looking for a way to do that, but didn't see one!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] codecov[bot] commented on pull request #21779: fix(plugin-chart-handlebars): Update webpack/babel config to fix build/runtime warnings/errors

Posted by GitBox <gi...@apache.org>.
codecov[bot] commented on PR #21779:
URL: https://github.com/apache/superset/pull/21779#issuecomment-1275575293

   # [Codecov](https://codecov.io/gh/apache/superset/pull/21779?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#21779](https://codecov.io/gh/apache/superset/pull/21779?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (7049116) into [master](https://codecov.io/gh/apache/superset/commit/406e44bba11f6b233c3b07d29efd158b8cfc9615?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (406e44b) will **decrease** coverage by `0.02%`.
   > The diff coverage is `n/a`.
   
   > :exclamation: Current head 7049116 differs from pull request most recent head 5391152. Consider uploading reports for the commit 5391152 to get more accurate results
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #21779      +/-   ##
   ==========================================
   - Coverage   66.88%   66.86%   -0.03%     
   ==========================================
     Files        1800     1803       +3     
     Lines       68967    68996      +29     
     Branches     7339     7349      +10     
   ==========================================
   + Hits        46128    46132       +4     
   - Misses      20943    20971      +28     
   + Partials     1896     1893       -3     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | javascript | `53.19% <ø> (-0.04%)` | :arrow_down: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/21779?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...ontrols/DateFilterControl/utils/dateFilterUtils.ts](https://codecov.io/gh/apache/superset/pull/21779/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRlRmlsdGVyQ29udHJvbC91dGlscy9kYXRlRmlsdGVyVXRpbHMudHM=) | `39.39% <0.00%> (-60.61%)` | :arrow_down: |
   | [...nd/src/dashboard/components/gridComponents/Row.jsx](https://codecov.io/gh/apache/superset/pull/21779/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL2dyaWRDb21wb25lbnRzL1Jvdy5qc3g=) | `51.21% <0.00%> (-23.79%)` | :arrow_down: |
   | [...nts/controls/DateFilterControl/DateFilterLabel.tsx](https://codecov.io/gh/apache/superset/pull/21779/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRlRmlsdGVyQ29udHJvbC9EYXRlRmlsdGVyTGFiZWwudHN4) | `35.71% <0.00%> (-5.70%)` | :arrow_down: |
   | [...ontrols/DndColumnSelectControl/DndFilterSelect.tsx](https://codecov.io/gh/apache/superset/pull/21779/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EbmRDb2x1bW5TZWxlY3RDb250cm9sL0RuZEZpbHRlclNlbGVjdC50c3g=) | `44.03% <0.00%> (-1.01%)` | :arrow_down: |
   | [superset-frontend/src/components/Chart/Chart.jsx](https://codecov.io/gh/apache/superset/pull/21779/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvQ2hhcnQvQ2hhcnQuanN4) | `51.66% <0.00%> (-0.88%)` | :arrow_down: |
   | [...et-ui-chart-controls/src/shared-controls/index.tsx](https://codecov.io/gh/apache/superset/pull/21779/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY2hhcnQtY29udHJvbHMvc3JjL3NoYXJlZC1jb250cm9scy9pbmRleC50c3g=) | `53.44% <0.00%> (-0.79%)` | :arrow_down: |
   | [superset-frontend/src/explore/constants.ts](https://codecov.io/gh/apache/superset/pull/21779/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29uc3RhbnRzLnRz) | `100.00% <0.00%> (ø)` | |
   | [...ntend/plugins/plugin-chart-table/src/buildQuery.ts](https://codecov.io/gh/apache/superset/pull/21779/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGx1Z2lucy9wbHVnaW4tY2hhcnQtdGFibGUvc3JjL2J1aWxkUXVlcnkudHM=) | `56.25% <0.00%> (ø)` | |
   | [...nd/packages/superset-ui-core/src/query/getXAxis.ts](https://codecov.io/gh/apache/superset/pull/21779/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGFja2FnZXMvc3VwZXJzZXQtdWktY29yZS9zcmMvcXVlcnkvZ2V0WEF4aXMudHM=) | `100.00% <0.00%> (ø)` | |
   | [...nd/plugins/plugin-chart-table/src/controlPanel.tsx](https://codecov.io/gh/apache/superset/pull/21779/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGx1Z2lucy9wbHVnaW4tY2hhcnQtdGFibGUvc3JjL2NvbnRyb2xQYW5lbC50c3g=) | `53.12% <0.00%> (ø)` | |
   | ... and [35 more](https://codecov.io/gh/apache/superset/pull/21779/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] zhaoyongjie commented on pull request #21779: fix(plugin-chart-handlebars): Update webpack/babel config to fix build/runtime warnings/errors

Posted by GitBox <gi...@apache.org>.
zhaoyongjie commented on PR #21779:
URL: https://github.com/apache/superset/pull/21779#issuecomment-1277171289

   > _Total side note: Apologies to Evans, who gets pinged by this project all the time, and is not me ;)_
   
   I really wanted to say sorry to Evan, and buy him a drink.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org