How to improve nested requires?
See original GitHub issueWe would like to figure out how to improve requiring modules.
e.g. take a look at this - we have to go back in the folder tree to be able to require the logging module.
The same problem exists in our test env, see.
global require function
One option could be to add a global.requireSomething
fn, which is able to read modules from a defined root path.
e.g. requireRoot('services')
- would require a module from the core/server
folder.
e.g. requireLib('errors')
- would require a module inside core/server/lib
other options?
Wait that Node supports import/export
and a similar module like ember-resolve. So you can do:
import * from 'ghost/services'
- that would be so cool 🙊
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (8 by maintainers)
Top Results From Across the Web
Computer Programming/Coding Style/Minimize nesting
Deeply nested code is a common feature of structured programming. While it has some advantages, discussed in that section, it is frequently considered...
Read more >Javascript: How to improve nested for loops | by Tim Hannan
In this article, we will improve the performance of a function with a nested loop by converting the array from the outer loop...
Read more >How to reduce the time complexity of nested loops
In this post I'll demonstrate a way to understand, analyse and reduce the time complexity on algorithms, specially on nested loops.
Read more >How to improve algorithm efficiency for nested loop
Have a Set of numbers you have seen, starting empty; Look at each number in the input list; Calculate which number you would...
Read more >c# - How to optimize these nested loops for better performance?
I need to optimize this code so it can execute faster, even if that means using more memory: for (int t = 0;...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
In case it could be useful in future, here’s a script to rewrite the require paths using the current directory as root.
@ernstwi Hey, thanks for coming back. I’ll reply tomorrow 👋