You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "pksilen (via GitHub)" <gi...@apache.org> on 2025/06/17 11:36:55 UTC
[I] The build of generated Visualization plugin does not work out of the box [superset]
pksilen opened a new issue, #33788:
URL: https://github.com/apache/superset/issues/33788
### Bug description
I have generated a custom visualization plugin according to your documentation here: https://superset.apache.org/docs/contributing/howtos/#creating-visualization-plugins
When I try to build the plugin with `npm run build`, the following problems occur:
1. Compilation fails due to unused "sections" import in controlPanel.ts file. Commenting out that import fixes the build.
2. Running the tests in postbuild phase fails. I was only able to run the tests successfully after I installed jest dom package (jest-environment-jsdom) and configured it in jest.config.js.
3. Running the three tests can take relatively long time, e.g. from 30 secs to 1 minute.
4. When running the tests, there are a lot of warnings on the console which all start with this: `*You should call configure(...) before calling other methods*.
Here is an example stack-trace for the warnings:
```
18 | */
19 | import { t, validateNonEmpty } from '@superset-ui/core';
> 20 | import {
| ^
21 | ControlPanelConfig,
22 | // sections,
23 | sharedControls,
at getInstance (node_modules/@superset-ui/core/lib/translation/TranslatorSingleton.js:46:13)
at t (node_modules/@superset-ui/core/lib/translation/TranslatorSingleton.js:69:10)
at Object.<anonymous> (node_modules/@superset-ui/chart-controls/lib/shared-controls/legacySortBy.js:32:30)
at Object.<anonymous> (node_modules/@superset-ui/chart-controls/lib/index.js:95:21)
at Object.require (src/plugin/controlPanel.ts:20:1)
at Object.require (src/plugin/index.ts:21:1)
at Object.require (src/index.ts:20:1)
at Object.require (test/index.test.ts:19:1)
``
### Screenshots/recordings
_No response_
### Superset version
4.1.2
### Python version
Not applicable
### Node version
18 or greater
### Browser
Not applicable
### Additional context
_No response_
### Checklist
- [x] I have searched Superset docs and Slack and didn't find a solution to my problem.
- [x] I have searched the GitHub issue tracker and didn't find a similar bug report.
- [x] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
--
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.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
Re: [I] The build of generated Visualization plugin does not work out of the box [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas closed issue #33788: The build of generated Visualization plugin does not work out of the box
URL: https://github.com/apache/superset/issues/33788
--
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
Re: [I] The build of generated Visualization plugin does not work out of the box [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #33788:
URL: https://github.com/apache/superset/issues/33788#issuecomment-2980030129
<!-- Greeting -->
Hi @pksilen! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the superset team.
<!-- Answer -->
Here’s what’s going on and how you can address each issue:
1. The unused `sections` import in `controlPanel.ts` is a known issue with the plugin generator template. It’s safe to remove or comment out this import if you’re not using it—this won’t affect functionality and will resolve the build error. This is due to stricter TypeScript/lint settings in your environment and isn’t required for most plugins.
2. The test failures are because the generated plugin’s Jest config sometimes doesn’t specify the test environment. You need to install `jest-environment-jsdom` and add `testEnvironment: "jsdom"` to your `jest.config.js`. This simulates a browser environment, which is required for visualization/plugin tests. The official templates and docs expect this, but it’s easy to miss if you’re setting up manually or if the generator template is out of sync with your environment. See the [Superset Jest config example](https://github.com/apache/superset/blob/4d6cdf4fea44164e5953357ceceb44c93cdee8e3/superset-frontend/jest.config.js).
3. The slow test execution is mostly due to the heavy dependencies (`@superset-ui/core`, `@superset-ui/chart-controls`) being loaded cold for each test run, and possibly because tests are running serially. There’s not much you can do unless you optimize your test setup or reduce dependency size, but you can experiment with Jest’s parallelization settings or cache to speed things up.
4. The warnings about `You should call configure(...) before calling other methods` come from the Superset translation system. The translation singleton expects to be initialized with `configure()` before any translation calls (like `t` or `tn`). To fix this, create a Jest setup file (e.g., `jest.setup.js`) with:
```js
import { configure } from '@superset-ui/core';
configure({ languagePack: {} });
```
Then add this file to your `jest.config.js` under `setupFilesAfterEnv`. This will suppress the warnings and properly initialize translations for all tests. See the [translation system implementation](https://github.com/apache/superset/blob/4d6cdf4fea44164e5953357ceceb44c93cdee8e3/superset-frontend/packages/superset-ui-core/src/translation/TranslatorSingleton.ts).
There are some related issues and discussions in the Superset repo about plugin build/test friction and the plugin system being in flux, but nothing that directly addresses all these points. The plugin generator and docs may lag behind the latest best practices, so manual tweaks like these are sometimes necessary.
<!-- Dosu Comment Footer -->
*To reply, just mention [@dosu](https://go.dosu.dev/dosubot).*
---
<sup>How did I do? [Good](https://app.dosu.dev/response-feedback/89f852a7-5928-4bc1-b7b4-9638dc2679df?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/89f852a7-5928-4bc1-b7b4-9638dc2679df?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/89f852a7-5928-4bc1-b7b4-9638dc2679df?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/89f852a7-5928-4bc1-b7b4-9638dc2679df?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/89f852a7-5928-4bc1-b7b4-9638dc2679df?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/89f852a7-5928-4bc1-b7b4-9638dc2679df?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/89f852a7-5928-4bc1-b7b4-9638dc2679df?feedback_type=other)</sup> [](https://go.dosu.dev/discord-bot) [!
[Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/33788)
--
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
Re: [I] The build of generated Visualization plugin does not work out of the box [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #33788:
URL: https://github.com/apache/superset/issues/33788#issuecomment-4328530495
Thanks for the detailed report! Quick status update: we're migrating Superset's extensibility story over to the new [Extensions framework](https://github.com/apache/superset/tree/master/superset-extensions-cli) piece by piece, and viz components are very much on the radar.
Given that direction, we're not likely to invest in maintaining the legacy viz plugin generator package going forward — but we're absolutely open to fix PRs if you (or anyone else reading this) want to open one for the issues you've described (the unused `sections` import, the missing `jest-environment-jsdom` config, etc.). They sound like small, well-scoped fixes that would help anyone still using the generator in the interim.
--
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
Re: [I] The build of generated Visualization plugin does not work out of the box [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #33788:
URL: https://github.com/apache/superset/issues/33788#issuecomment-4898728828
As stated the legacy viz plugin generator won't be maintained since extensibility is migrating to the new Extensions framework (superset-extensions-cli), and community fix PRs are welcome. Closing as won't-fix.
--
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