nandorojo / dripsy

🍷 Responsive, unstyled UI primitives for React Native + Web.
https://dripsy.xyz
MIT License
1.98k stars 77 forks source link

Unable to resolve "stable-hash" from "node_modules\dripsy\build\core\use-sx.js" #296

Closed xementor closed 4 months ago

xementor commented 11 months ago

Static Rendering Error (Node.js) Metro has encountered an error: While trying to resolve module stable-hash from file H:\code\react_native\expo-router-tst\node_modules\dripsy\build\core\use-sx.js, the package H:\code\react_native\expo-router-tst\node_modules\stable-hash\package.json was successfully found. However, this package itself specifies a main module field that could not be resolved (H:\code\react_native\expo-router-tst\node_modules\stable-hash\dist\index.mjs. Indeed, none of these files exist:

oleh-mryhlod commented 11 months ago

Hi @xementor Adding .mjs files support to the metro.config.js fixed the issue for me - https://github.com/GeekyAnts/NativeBase/issues/4678#issuecomment-1066434275

My metro.config.js content:

// Learn more https://docs.expo.io/guides/customizing-metro
const { getDefaultConfig } = require('expo/metro-config');

/** @type {import('expo/metro-config').MetroConfig} */
const config = getDefaultConfig(__dirname, {
  // [Web-only]: Enables CSS support in Metro.
  isCSSEnabled: true,
});

config.resolver.sourceExts.push('mjs', 'cjs'); // fixes stable-hash module resolve issue

module.exports = config;
nandorojo commented 11 months ago

hm interesting, thanks for sharing @oleh-mryhlod. not sure why i didn't face this issue

dotfelixb commented 10 months ago

I had a similar issue with

    dripsy: 4.3.3,
    expo: 49.0.7,

@oleh-mryhlod fix to the rescue

dben89x commented 5 months ago

Hi @xementor Adding .mjs files support to the metro.config.js fixed the issue for me - GeekyAnts/NativeBase#4678 (comment)

My metro.config.js content:

// Learn more https://docs.expo.io/guides/customizing-metro
const { getDefaultConfig } = require('expo/metro-config');

/** @type {import('expo/metro-config').MetroConfig} */
const config = getDefaultConfig(__dirname, {
  // [Web-only]: Enables CSS support in Metro.
  isCSSEnabled: true,
});

config.resolver.sourceExts.push('mjs', 'cjs'); // fixes stable-hash module resolve issue

module.exports = config;

Same issue with

"dripsy": "^4.3.4",
"expo": "49.0.16",

This solution fixed it for me as well.

nandorojo commented 4 months ago

Solution: https://github.com/nandorojo/dripsy/issues/296#issuecomment-1655230271