iconify / iconify

Universal icon framework. One syntax for FontAwesome, Material Design Icons, DashIcons, Feather Icons, EmojiOne, Noto Emoji and many other open source icon sets (over 150 icon sets and 200k icons). SVG framework, React, Vue and Svelte components!
https://iconify.design/
MIT License
4.06k stars 117 forks source link

[DEP0166] DeprecationWarning #283

Open ojvribeiro opened 4 months ago

ojvribeiro commented 4 months ago

I started receiving this warning when I updated to latest Vue and Nuxt versions:

(node:21672) [DEP0166] DeprecationWarning: Use of deprecated double slash resolving ".//index.cjs" for module request ".//index.cjs" matched to "./*" in the "exports" field module resolution of the package at C:\Users\[...]\Documents\Projects\[...]\node_modules\@iconify\vue\package.json imported from C:\Users\[...]\Documents\Projects\[...]\node_modules\nitropack\node_modules.

I'm not sure if it is a @iconify/vue thing.

cyberalien commented 4 months ago

Yes, I've seen similar issues related to import ending in / in Nuxt after updating dependencies.

In my case it was fixed by removing / from import, so replaced import { stuff } from 'package/src/' with import { stuff } from 'package/src'.

Maybe you have an import that ends with /?

cyberalien commented 4 months ago

Also, for Nuxt I recommend using iconify-icon package, not @iconify/vue. See https://iconify.design/docs/iconify-icon/#ssr

ojvribeiro commented 4 months ago

Also, for Nuxt I recommend using iconify-icon package, not @iconify/vue. See https://iconify.design/docs/iconify-icon/#ssr

Oh, I didn't know about this one. Thank you very much.

KarelVendla commented 3 months ago

When running e2e tests I always got this error. I moved away from iconify/vue (the nuxt-icon package) to iconify-icon.

I import it via the min.js in the nuxt.config.ts

  vue: {
    compilerOptions: {
      isCustomElement: (tag) => tag === "iconify-icon",
    },
  },
  app: {
    head: {
      script: [
        {
          src: "https://code.iconify.design/iconify-icon/2.0.0/iconify-icon.min.js",
          key: "iconify-icon",
        },
      ],
    },
  },

The errors are gone. thank you @cyberalien for the recommendation.

ojvribeiro commented 3 months ago

@KarelVendla yeah, it seems the iconify-icon package is throwing the same warning on build. It seems I'll have to stick to the CDN for now.

cyberalien commented 3 months ago

l

Are you using it as part of nuxt icon package or separately?

ojvribeiro commented 3 months ago

@cyberalien basically, I created a custom component which uses iconify-icon behind the scenes. I just tried to import it in the component like this:

<script setup lang="ts">
  import 'iconify-icon' // this causes build warnings
</script>

<template>
  <iconify-icon icon="..." />
</template>

This snippet is a simplified version of the actual code.

cyberalien commented 3 months ago

Very strange. I'm importing it like that in Vue project too, no issues.

Can you post versions of vite, node and whatever package manager are you using?

ojvribeiro commented 3 months ago

Yeah, of course! This is the info generated by nuxt info:

------------------------------
- Operating System: Windows_NT
- Node Version:     v18.19.0
- Nuxt Version:     3.9.3
- CLI Version:      3.8.4
- Nitro Version:    2.8.1
- Package Manager:  yarn@1.22.19
- Builder:          -
- User Config:      extends, modules, imports, routeRules, app, googleFonts, tailwindcss, devtools
- Runtime Modules:  nuxt-typed-router@3.5.1, @vee-validate/nuxt@4.12.4, @nuxtjs/device@3.1.1, nuxt-og-image@3.0.0-rc.38
- Build Modules:    -
------------------------------

It is important to note that the warning only shows on build, not dev. It happens to @vueuse/core as well.

cyberalien commented 1 month ago

I've seen reports that removing shamefully-hoist=true from .npmrc fixes that.

konstantin-karlovich-unbiased-co-uk commented 1 week ago

I've seen reports that removing shamefully-hoist=true from .npmrc fixes that.

The warning is still present