Skip to content
This repository was archived by the owner on May 6, 2022. It is now read-only.

Simplify component import paths using aliasing #15

Open
developher-net opened this issue Oct 9, 2019 · 1 comment
Open

Simplify component import paths using aliasing #15

developher-net opened this issue Oct 9, 2019 · 1 comment
Labels
enhancement New feature or request

Comments

@developher-net
Copy link
Owner

When importing components into pages, it gets very tedious to write deep relative paths.

// /pages/path/to/my/page/index.jsx
import Button from '../../../../../components/atoms/Button'

If the page route changes (and therefore the location of the file) the relative paths all need to be updated, which is a lot of unnecessary work.

This can be solved with module-alias which provides a method of aliasing these for easier use:

// /pages/path/to/my/page/index.jsx
import Button from '@atoms/Button'
@developher-net developher-net added the enhancement New feature or request label Oct 9, 2019
@developher-net
Copy link
Owner Author

developher-net commented Oct 18, 2019

Alternatively, https://github.com/johvin/eslint-import-resolver-alias is a solution that should work with eslint rules so IDEs don't complain about paths they can't resolve.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant