Open wojtekmaj opened 8 months ago
It seems the issue might be:
var _reactNative = require("react-native");
is there any updates on that issue?
I'm having a similar problem, but with other dependency:
SyntaxError: Cannot use import statement outside a module
❯ Object.newLoader [as .js] node_modules/pirates/lib/index.js:121:7
I have the same error message except it appears for a firebase import, I tried a lot of things, but nothing seems to work.
The same issue, we can't add any related configs to react native library (as @testing-library/react-native or react-native-unistyles) to the setup file in vitest.config. It's really a big blocker
In the jest world, this type of ESM/CJS modules dependency mismatch error is managed via package.json
configuration:
{ ...
"jest": {
...
"transformIgnorePatterns": [ ... ]
}
}
I am just getting started trying to integrate vitest with react-native and react-native-testing-library. All I have done is some web searches on the topic. Before I get started with attempting the integration, I wanted to ask if there is a similar configuration requirement for vitest to manage dependencies using either ESM or CJS module syntax?
source-diving, I am encouraged to see there is some code already in this repo to handle esm/cjs issues: https://github.com/sheremet-va/vitest-react-native/blob/21276b8bb4c43eddd4a8e62f7c74e6dcb94bb24c/packages/vitest-react-native/setup.js#L54-L64
As soon as I setup app using
@testing-library/react-native
, I get:I previously raised #5 and closed it, but it seems the same issue is now "passed over" to @testing-library/react-native.