Open mordonez-me opened 11 months ago
This is everywhere
@mordonez-me any updates? Facing the same issue
I just patched everywhere
Could you let me know if you found the error? I can try again if it's fixed, lmk.
I got the same error when trying to test my module by use jest. But it work with ts-node
ts-node metadata.spec.ts
(success)
npm run test medata.spec.ts
(Unable to resolve "@metaplex-foundation/umi/serializers" from...)
Ran into this issue on React Native and after some investigation might have found the root cause.
This issue is caused because the @metaplex-foundation/umi
package uses Package Exports to export the umi/serializers
submodule.
React Native's Metro Bundler doesn't support Package Exports by default, so it is unable to find umi/serializers
. Currently, Package Exports are an experimental feature in Metro and can be enabled following this guide.
Following the guide, I enabled the experimental unstable_enablePackageExports
flag, which actually fixed the issues with @metaplex-foundation/umi/serializers
and the bundler was able to find it.
This is what I added to metro.config.js
:
module.exports = {
...
resolver: {
unstable_enablePackageExports: true,
unstable_conditionNames: ['types', 'require', 'import'],
},
But it ran into another issue when trying to resolve an import within umi-bundle-defaults
.
Error: Unable to resolve module ./plugin from /Users/mikesulistio/testing/umi-testing/UmiTestRN/node_modules/@metaplex-foundation/umi-bundle-defaults/dist/types/index.d.ts:
enabling the unstable_enablePackageExports
without specifying unstable_conditionNames
made my test app build.
module.exports = {
...
resolver: {
unstable_enablePackageExports: true,
},
Find the bare bones app that can build here. NOTE: the button doesn't actually create an asset since it's expecting crypto to be there but the imports seem to be working as expected
As an additional workaround for node.js express @Gin on Discord shared that this worked for them:
const moduleAlias = require('module-alias');
moduleAlias.addAlias('@metaplex-foundation/umi/serializers', '@metaplex-foundation/umi-serializers');
No clue about what is going here...
Libraries
Code:
Stacktrace: