0

I'm going over Chainlink tutorials.

Sometime I see Chainlink imports using @chainlink/path/to/contract and other times https://github.com/smartcontractkit/chainlink/blob/path/to/contract.

Are Contracts in production suppose to use the live Github link? Or the other import?

I'm confused, because I can't find any explanation for when you'd want to use one vs the other.

When do you use one over the other?

1

The first import with @ is for a local import and the second one is for an online version.

What you typically do in projects is install a node package locally and use that (the first version). The benefit is that the package will never change, it's always available (no need to worry about possible connectivity issues) and is faster to use.

If you use an online version you have to have connectivity and there are no guarantees that the package wouldn't change (yes, even if the URI has a version number the package can, in theory, change). This kind of import is typically only used for quick testing and prototyping - it shouldn't be used in production.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.