x64Bits / solid-icons

The simplest way to use icons in SolidJS
https://solid-icons.vercel.app
MIT License
284 stars 18 forks source link

Issues with modules #58

Open semiautomatix opened 7 months ago

semiautomatix commented 7 months ago

I'm busy with Solid Start project that requires icons.

Very excited for solid-icons, but I'm struggling to use this in my component library.

12:48:43 PM [vite] Error when evaluating SSR module ~start/entry-server: failed to import "/@fs/workspace/monorepo/node_modules/.pnpm/solid-start@0.3.10_@solidjs+meta@0.29.1_@solidjs+router@0.8.4_solid-js@1.8.5_solid-start-node@0.3.10_vite@4.5.0/node_modules/solid-start/entry-server/index.ts"
|- /workspace/monorepo/node_modules/.pnpm/solid-icons@1.1.0_solid-js@1.8.5/node_modules/solid-icons/hi/index.js:1
import { IconTemplate } from "../lib/index.jsx";
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at internalCompileFunction (node:internal/vm:73:18)
    at wrapSafe (node:internal/modules/cjs/loader:1153:20)
    at Module._compile (node:internal/modules/cjs/loader:1205:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1295:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at cjsLoader (node:internal/modules/esm/translators:284:17)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:234:7)
    at ModuleJob.run (node:internal/modules/esm/module_job:217:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
    at async nodeImport (file:///workspace/monorepo/node_modules/.pnpm/vite@4.5.0_@types+node@20.9.1_less@4.2.0/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:56097:17)
    at async ssrImport (file:///workspace/monorepo/node_modules/.pnpm/vite@4.5.0_@types+node@20.9.1_less@4.2.0/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:55990:24)
    at async eval (/workspace/monorepo/packages/flowbite-react-solid/dist/server.mjs:6:31)
    at async instantiateModule (file:///workspace/monorepo/node_modules/.pnpm/vite@4.5.0_@types+node@20.9.1_less@4.2.0/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:56052:9)

"solid-start": "^0.3.10"

$ node -v v20.9.0

"name": "solid-icons", "version": "1.1.0",

import { HiOutlineChevronLeft, HiOutlineChevronRight } from "solid-icons/hi";
carere commented 7 months ago

Same problem here...

carere commented 7 months ago

@semiautomatix I switched back to the previous version, latest version broke something

Hentioe commented 3 months ago

The latest version 1.1.0 will cause errors, I tried the old version 1.0.12 and everything works fine.

Update: After I switched to Vite, the latest version no longer has build errors. Previously I used Webpack.