Absolute path guide (import alias)


Setting up import aliases and using absolute path is more to do about readability and the look of our code when importing components from the import tree. So the code may look clean like this:

“import Section from '~sections/newsletter/mixins/Subscribe’

instead of

‘import Subscribe from '../../../../../../../sections/newsletter/mixins/Subscribe’

That’s why we configured and used absolute path for importing in most cases and whenever possible. Though we couldn’t use absolute path for some of our image import as we used [gatsby-plugin-image] which doesn’t support absolute path.

However, You can use the absolute paths we have configured for most cases other than images. They are given for your reference below:

image

Note: Here the left key is the configured absolute path and the right value refers to the actual folder.