Webpack omitting @emotion/styled; Uncaught ReferenceError: _styled is not defined
thrown at runtime
#29317
-
TL;DR: Webpack build seems to be omitting a specific node_module which is used, leading to Hey everybody. I'm struggling with some weird Webpack behavior and cannot figure out what to do. Anybody able/willing to help me figure it out?
Attachments: I'm a bit at a loss how to proceed. 😭 Anybody got ideas or tips how to debug this? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
+1. Facing this exact issue with almost identical context/circumstances |
Beta Was this translation helpful? Give feedback.
-
Huzzah! I may have at least figured out a workaround! 🎉 Converting that particular file to use a re-export syntax ( Diff: diff --git a/superset-frontend/packages/superset-ui-core/src/style/index.tsx b/superset-frontend/packages/superset-ui-core/src/style/index.tsx
index ee0b6e10ac4199fbca8ff92fa83cc424ddc00715..39cdfa294fb390270d2104f7faed567a79d46803 100644
--- a/superset-frontend/packages/superset-ui-core/src/style/index.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/style/index.tsx
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-import emotionStyled from '@emotion/styled';
import { useTheme as useThemeBasic } from '@emotion/react';
import createCache from '@emotion/cache';
@@ -29,6 +28,7 @@ export {
withTheme,
} from '@emotion/react';
export { default as createEmotionCache } from '@emotion/cache';
+export { default as styled } from '@emotion/styled';
declare module '@emotion/react' {
// eslint-disable-next-line @typescript-eslint/no-empty-interface
@@ -50,8 +50,6 @@ export const emotionCache = createCache({
key: 'superset',
});
-export const styled = emotionStyled;
-
const defaultTheme = {
borderRadius: 4,
colors: { I'm so confused why this issue seems to have only appeared sporadically, but I'm just so relieved to have found something that seems to fix it for now. |
Beta Was this translation helpful? Give feedback.
Huzzah! I may have at least figured out a workaround! 🎉
Converting that particular file to use a re-export syntax (
export ... from '...'
) instead of an import followed byexport const ...
seems to have worked around the issue for me. Webpack builds continue to succeed as before, and main dashboard UI now loads fully without throwing the error described above.Diff: