I want to use react-admin
in a project with snowpack
but I encounter the following error
✖ snowpack failed to load node_modules/ra-core/node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js
'default' is not exported by node_modules/@sheerun/mutationobserver-shim/dist/mutationobserver.min.js, imported by node_modules/ra-core/node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js
I'm not sure this is a bug of react-admin
or one of it's dependencies, it might be solvable by changing the config snowpack.config.json
Reproduction steps
Initialised a Snowpack project with Create Snowpack App
npx create-snowpack-app new-dir --template @snowpack/app-template-react --use-yarn
add package react-admin
yarn add `react-admin`
add the following line in src/index.jsx
import { Admin } from 'react-admin'
run command to start application
npm start
The there will be a bunch of warnings like:
The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten
Conflicting namespaces: node_modules/ra-core/esm/i18n/index.js re-exports 'TranslationContext' from both node_modules/ra-core/esm/i18n/index.js and node_modules/ra-core/esm/i18n/TranslationContext.js (will be ignored)
Conflicting namespaces: node_modules/ra-core/node_modules/@testing-library/react/dist/@testing-library/react.esm.js re-exports 'fireEvent' from both node_modules/ra-core/node_modules/@testing-library/react/dist/@testing-library/react.esm.js and node_modules/ra-core/node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js (will be ignored)
Warning: 1+ circular dependencies found via "node_modules/ra-core/esm/actions/index.js"
Then finally the start script finished with the error
✖ snowpack failed to load node_modules/ra-core/node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js
'default' is not exported by node_modules/@sheerun/mutationobserver-shim/dist/mutationobserver.min.js, imported by node_modules/ra-core/node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js