mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
fixup! Add a brief summary of import types and path resolution to the source layout docs
This commit is contained in:
parent
c3e133a55b
commit
747a38aa27
@ -263,10 +263,16 @@ The compiler recognizes two kinds of imports, based on how the import path looks
|
||||
import "./contracts/lib/token.sol" as token1;
|
||||
import "../contracts/lib/token.sol" as token2;
|
||||
|
||||
Unlike in case of a direct import, the compiler does assume that the import path is actually a path.
|
||||
Unlike in case of a direct import, the compiler does assume that the import path works like a path.
|
||||
The source unit name is a result of combining the source unit name of the importing file with
|
||||
the part of the path provided in the statement.
|
||||
|
||||
.. note::
|
||||
|
||||
The use of relative imports with leading ``../`` segments is not recommended.
|
||||
The same effect can be achieved in a more reliable way by using direct imports with
|
||||
:ref:`base path <base-path>` and :ref:`import remapping <import-remapping>`.
|
||||
|
||||
There are several compiler features that can affect import paths. Imports can be redirected using
|
||||
:ref:`import remapping <import-remapping>` while the way file loader resolves relative paths depends
|
||||
on :ref:`base path <base-path>`.
|
||||
|
Loading…
Reference in New Issue
Block a user