rocketclimb / rocketicons

React and reactive natives powered by Tailwind
https://rocketicons.io
MIT License
57 stars 0 forks source link

Unable to import into a remix spa mode (vite) app #132

Closed neilhsmith closed 1 week ago

neilhsmith commented 1 month ago

Directory import '...\node_modules\rocketicons\core' is not supported resolving ES modules imported from ...\node_modules\rocketicons\lu\index.mjs

I'm in a Remix v2.9.1 spa mode app (vite version is 5.1.0) but it errors with the above as long as any rocketicon import is in the project. I've tried import { LuLoader2 } from "rocketicons/lu"; and import { DiAngularSimple } from "rocketicons/di"; but get the same error.

amorimjj commented 1 month ago

Hi @neilhsmith, thanks for your report.

I was able to reproduce the issue here. I've taken a look, but I'm not sure how we can fix that. The issue is because we can't force the index.mjs on import because we need React Native to select index.native.mjs when needed.

That said, I was able to run Rocketicons on Remix using --experimental-specifier-resolution=node.

I did that updating the package.json

"scripts": {
    ...
    "dev": "NODE_OPTIONS='--experimental-specifier-resolution=node' remix vite:dev",
    "start": "NODE_OPTIONS='--experimental-specifier-resolution=node' remix-serve ./build/server/index.js",
    ...
  },

I hope it helps you for now.

amorimjj commented 1 week ago

This issue was closed because it has been inactive for more than 14 days