-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
ra-core causes @testing-library/react to be bundled in prod #4618
Comments
Thanks fro the report, see #3851 for the history of that dependency and the justification for bundling it to production. The problem is that The IE11 bug is a real concern, though I suspect it can be fixed by a shim? |
Hmm, I might be missing something but
|
right, but how do we make it available from ra-core to ra-ui-material-ui? |
The smallest option would be: modified packages/ra-ui-materialui/src/input/CheckboxGroupInput.spec.tsx
@@ -3,267 +3,268 @@ import expect from 'expect';
import CheckboxGroupInput from './CheckboxGroupInput';
import { render, cleanup, fireEvent } from '@testing-library/react';
import { Form } from 'react-final-form';
-import { renderWithRedux, TestTranslationProvider } from 'ra-core';
+import { TestTranslationProvider } from 'ra-core';
+import renderWithRedux from 'ra-core/src/util/renderWithRedux'; Though for consistency and clarity I guess I would do: modified packages/ra-ui-materialui/src/input/CheckboxGroupInput.spec.tsx
@@ -3,267 +3,267 @@ import expect from 'expect';
import CheckboxGroupInput from './CheckboxGroupInput';
import { render, cleanup, fireEvent } from '@testing-library/react';
import { Form } from 'react-final-form';
-import { renderWithRedux, TestTranslationProvider } from 'ra-core';
+import { renderWithRedux, TestTranslationProvider } from 'ra-core/src/devUtils'; |
Fixed by #5846 |
What you were expecting:
Production bundle of an app containing react-admin to not contain
@testing-library/react
and its dependencies.What happened instead:
@testing-library/react
was included in a production bundle. As a side-effect, IE11 broke due topretty-format
(a dependency of@testing-library/react
) containing code that relies onSymbol
, which is not available in IE11.Steps to reproduce:
Unfortunately none at the moment as I cannot share the project and this doesn't happen in a create-react-app project (which perhaps has a more sophisticated code elimination). Might be able to create a minimal test case later.
Related code:
I fixed this build by locally patching
util/index.js
at this point to not import and re-exportrenderWithRedux
(which in turn depends on@testing-library/react
).Files needing
renderWithRedux
seem to be needed during dev only:They could be fixed by having them import from
../util/renderWithRedux
directly. Happy to provide a PR if that sounds sensible.Also,
@testing-library/react
is reported in ra-core's package.json dependencies instead of devDependencies.The text was updated successfully, but these errors were encountered: