question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Solving the `../../../` problem.

See original GitHub issue

Is it possible to support importing local modules relative to the root directory (or something along those lines) without ejecting? In other words, go from this:

import bar from '../../../foo/bar';

to this:

import bar from 'foo/bar'; // or '@foo/bar', or '@bar', or what have you

I have done this before with create-react-native-app after ejecting by using the babel-plugin-module-resolver.

This can also be accomplished using Webpack aliases.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

9reactions
percyhannacommented, Dec 13, 2017

NODE_PATH doesn’t seem like the right solution, as it’s very sensitive to local environments.

Is there a reason why paths.appSrc isn’t added to resolve as a default source path? That seems like a much better solution that provides absolute paths out of the box, and isn’t fragile based on user environment/configuration.

1reaction
Palisandcommented, Nov 30, 2017

@Timer Was this closed because using NODE_PATH, which some would consider confusing or an anti-pattern, is really the only way to accomplish this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is Problem Solving? Steps, Process & Techniques - ASQ
Problem solving is the act of defining a problem; determining the cause of the problem; identifying, prioritizing, and selecting alternatives for a solution ......
Read more >
How to Solve Problems - Harvard Business Review
As you and your colleagues consider these ideas, think about the last problem you had to solve as a team. First, map out...
Read more >
Problem solving - Wikipedia
Problem solving is the process of achieving a goal by overcoming obstacles, a frequent part of most activities. Problems in need of solutions...
Read more >
8-Step Problem Solving Process | University Human Resources
8-Step Problem Solving Process · Step 1: Define the Problem · Step 2: Clarify the Problem · Step 3: Define the Goals ·...
Read more >
Problem-solving strategies to turn challenges on their head
What skills do efficient problem solvers have? How to improve your problem-solving skills. Problems come in all shapes and sizes — from ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found