Renovamen / oh-vue-icons

A Vue component for importing inline SVG icons from different popular icon packs easily.
https://oh-vue-icons.js.org
Other
245 stars 22 forks source link

No support for SSR #43

Closed HeldvonKosmos closed 2 months ago

HeldvonKosmos commented 2 months ago

Hello there, i tried to use SSR support of inertiajs and got this error:

######################################### [jonas@localhost KIM]$ php artisan inertia:start-ssr (node:477768) [MODULE_TYPELESS_PACKAGE_JSON] Warning: file:///home/KIM/node_modules/oh-vue-icons/icons/index.js parsed as an ES module because module syntax was detected; to avoid the performance penalty of syntax detection, add "type": "module" to /home/KIM/node_modules/oh-vue-icons/package.json (Use node --trace-warnings ... to show where the warning was created) node:internal/modules/esm/resolve:251 throw new ERR_UNSUPPORTED_DIR_IMPORT(path, fileURLToPath(base), String(resolved)); ^

Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import '/home/KIM/node_modules/oh-vue-icons/icons/ai' is not supported resolving ES modules imported from /home/KIM/node_modules/oh-vue-icons/icons/index.js at finalizeResolution (node:internal/modules/esm/resolve:251:11) at moduleResolve (node:internal/modules/esm/resolve:914:10) at defaultResolve (node:internal/modules/esm/resolve:1038:11) at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:554:12) at ModuleLoader.resolve (node:internal/modules/esm/loader:523:25) at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:246:38) at ModuleJob._link (node:internal/modules/esm/module_job:126:49) { code: 'ERR_UNSUPPORTED_DIR_IMPORT', url: 'file:///home/KIM/node_modules/oh-vue-icons/icons/ai' }

Node.js v22.8.0 #########################################

After adding the type module in package.json of the ohh-vue-icons package i got this error

######################################### [jonas@localhost KIM]$ php artisan inertia:start-ssr node:internal/modules/esm/resolve:251 throw new ERR_UNSUPPORTED_DIR_IMPORT(path, fileURLToPath(base), String(resolved)); ^

Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import '/home/KIM/node_modules/oh-vue-icons/icons/ai' is not supported resolving ES modules imported from /home/KIM/node_modules/oh-vue-icons/icons/index.js at finalizeResolution (node:internal/modules/esm/resolve:251:11) at moduleResolve (node:internal/modules/esm/resolve:914:10) at defaultResolve (node:internal/modules/esm/resolve:1038:11) at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:554:12) at ModuleLoader.resolve (node:internal/modules/esm/loader:523:25) at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:246:38) at ModuleJob._link (node:internal/modules/esm/module_job:126:49) { code: 'ERR_UNSUPPORTED_DIR_IMPORT', url: 'file:///home/KIM/node_modules/oh-vue-icons/icons/ai' }

Node.js v22.8.0 #########################################

Thanks in Advance!

Jonas

HeldvonKosmos commented 2 months ago

There was a simple mistake of mine. i only need to add " ssr: { noExternal: ['oh-vue-icons'] }" to the vite.config.js Now i need to test, if everything is working well.

HeldvonKosmos commented 2 months ago

Editing vite.config.js works well