Reputation: 1472
I have a package in my dependencies in package.json
of npm. I have included the package from github in following way-
"dependencies": {
"@aeternity/aepp-components": "git+https://[email protected]/aeternity/aepp-components.git#feature/v3",`
}
When I run npm install
, everything installs, and I can see the module in node_modules
folder. However when I try to import
, and run
, npm gives an error saying
dependancy not found
To install it, you can run: npm install --save aepp-components
What am i doing wrong here?
Edit: Snippet I used to import:
import AeButton from 'aepp-components'
Upvotes: 0
Views: 325
Reputation: 6831
When you have @something/package-name
, this is the name of the entire package, you have to import using this full name. Now, why?
This is called a scoped package, and @something
is the scope of that package. You can check more about scoped packages here.
Some packages exports items/components/whatever inside an object, which requires you to use the destructuring method. You can only be sure how it is imported if you look at the docs, otherwise you would need to deep into the codebase.
Upvotes: 0
Reputation: 30739
You need to do
import { AeButton } from '@aeternity/aepp-components'
see that how AeButton
is imported using destructuring. And @aeternity
specifies the default root source for the files and helps you map your file imports to it. Use that and it will work. You can also have a look at here in the doc
Upvotes: 2