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

Proposal: let's use rfr #104

Open
fernandocanizo opened this issue Apr 26, 2021 · 4 comments
Open

Proposal: let's use rfr #104

fernandocanizo opened this issue Apr 26, 2021 · 4 comments

Comments

@fernandocanizo
Copy link

rfr allows to make all requires from the root of the project, reducing the cognitive load by avoiding to have in mind where is a file to realize where a required module lives.

From it's README page:

allows you to require modules in your project with rfr('lib/module1.js') instead of something like require ('../../lib/module1.js')

I offer myself to make such a change should be the idea accepted.

@hagopj13
Copy link
Owner

hagopj13 commented Jul 4, 2021

@fernandocanizo sounds like a great idea. I like it!

How about requirejs? Doesn't it provide a similar feature?

@abernh
Copy link

abernh commented Oct 19, 2021

Here is a little listing of different options to solve the "confusing path names" problem:
https://gist.github.com/branneman/8048520

It concludes with using module-alias - which also has a much better track record and usage in current projects compared to rfr (not actually used) or requirejs (not used anymore)

@abernh
Copy link

abernh commented Oct 19, 2021

And then I have to append that even that is now discouraged and the use of nodejs' native import-mapping (since v14.6.0, v12.19.0) is to be used instead (via ilearnio/module-alias#113 )

Constant change. The only thing to be certain of ;)

@getdir
Copy link

getdir commented Mar 17, 2022

There's a much simpler way to achieve this...

add jsconfig.json to your root directory & then...

{
"compilerOptions": { "target": "es6", "baseUrl": "src" },
"include": [ "src" ],
"exclude": [ "node_modules" ]
}

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

No branches or pull requests

4 participants