Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use alias to get rid of ../ paths for modules #117

Merged
merged 1 commit into from
Feb 23, 2019
Merged

Conversation

jdeal
Copy link
Contributor

@jdeal jdeal commented Feb 23, 2019

Lots of ../../.. in the source and in the docs made things pretty cumbersome. Now, there's an alias @ which points to the root directory. I went with @ instead of a name like root just to avoid any confusion thinking there's a real npm module with that name.

Also, this could have been done with a single babel plugin, but there seems to be some concern that jest or webpack caching may break, so instead I went with tool-specific plugins/settings for webpack/jest/rollup. See tleunen/babel-plugin-module-resolver#346 and other issues for details on the potential problem with the babel plugin.

For now, I kept all the ./ sibling paths. I'd be find switching those to absolute, but there isn't as much to gain there, so I just left them for now.

cc @stevelikesmusic I'll be merging this right away to keep things moving, but feel free to continue the convo if you have any other opinions here.

Lots of ../../.. in the source and in the docs made things pretty cumbersome. Now, there's an alias `@` which points to the root directory. I went with `@` instead of a name like `root` just to avoid any confusion thinking there's a real npm module with that name.

Also, this could have been done with a single babel plugin, but there seems to be some concern that jest or webpack caching may break, so instead I went with tool-specific plugins/settings for webpack/jest/rollup.

tleunen/babel-plugin-module-resolver#346
@jdeal jdeal merged commit fd8f757 into master Feb 23, 2019
@jdeal jdeal deleted the absolute-paths branch February 23, 2019 17:09
@stevelikesmusic
Copy link

Nice addition @jdeal!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants