Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Invalid module name in augmentation - Module 'vue-unicons/src/icons' resolves to an untyped module #21

Open
duktiga-havet opened this issue Dec 14, 2019 · 6 comments

Comments

@duktiga-havet
Copy link

duktiga-havet commented Dec 14, 2019

I'm getting the error below using vue-unicons in a Nuxt project with typescript.

ERROR in .../node_modules/vue-unicons/src/main.d.ts                                                                                  
Invalid module name in augmentation. Module 'vue-unicons/src/icons' resolves to an untyped module at '.../node_modules/vue-unicons/src/icons.js', which cannot be augmented.
   
  >   | declare module "vue-unicons/src/icons" {
      |                ^
      |   export const icons: { name: string; path: string }
      | }

I'm using the latest versions of vue-unicons (2.0.3), Nuxt (2.10.2) and nuxt/typescript (2.8.1).

I loaded it by writing the Nuxt vue plugin below:

import Vue from 'vue'
import Unicon from 'vue-unicons'
import { uniLayerGroupMonochrome, uniCarWash } from 'vue-unicons/src/icons'
Unicon.add([uniLayerGroupMonochrome, uniCarWash])
Vue.use(Unicon)

The icons do appear but I can't make that error go away. Any idea how to look into this more deeply?

I'm not sure whether it's a problem with vue-unicons or with @nuxt/typescript or my code.

@rafalolszewski94
Copy link

rafalolszewski94 commented Jan 4, 2020

It's a problem with this lib.

Abandoned project?

@duktiga-havet
Copy link
Author

I dodged it by rebuilding my project without typescript

@davestewart
Copy link

davestewart commented May 29, 2020

Getting the same thing as well.

Sadly, this nukes my production build, so I won't be able to use the lib.

Should this be prioritised to be fixed @antonreshetov ?

@davestewart
Copy link

Proper bundling may solve this; see #34

@kmycode
Copy link

kmycode commented Jul 25, 2020

I created mainjs.js file.

import Vue from 'vue';
import Unicon from 'vue-unicons';

import { uniSave, uniBars, uniAngleLeftB, uniAngleLeft, uniListUl, uniBookOpen, uniBookAlt, uniHdd, uniCloud } from 'vue-unicons/src/icons.js';
Unicon.add([uniSave, uniBars, uniAngleLeftB, uniAngleLeft, uniListUl, uniBookOpen, uniBookAlt, uniHdd, uniCloud]);
Vue.use(Unicon);

Next, add following line in main.ts.

import './mainjs';

It works in my project.

@geopic
Copy link
Contributor

geopic commented Nov 19, 2020

An update has been pushed which should fix all of the problems you guys have had. As I said in the PR, if there are any issues then let me know. Apologies for the wait, I see it's been a while! 👀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants