Respect NODE_PATH environment variable
See original GitHub issueI wanted to try out create-react-app
on our internal monorepo, which is basically structured into 2 folders: “apps” and “components”.
The “apps” contain just an entry index.js file and their build/transpile configuration and import a root component from the components directory.
This is currently solved by directing imports using NODE_PATH
environment variable to make tools look into the components folder (so that you can write import Button from 'ns-button'
instead of import Button from '../../../components/ns-button
).
Personally I would feel that this would be worthwhile to support so this project could work with a wide variety of “non-standard” project layouts.
Issue Analytics
- State:
- Created 7 years ago
- Comments:14 (11 by maintainers)
Top Results From Across the Web
Node.js NODE_PATH environment variable - Stack Overflow
During development I used to WebStorm node_path =. environment variable. I have set up a variable in the launch of the project settings....
Read more >[Proposal] Make node name accessible as environment variable
From the NODE_PATH environment variable you pointed out, I come to a little concerns that the name path may be mistaken as the...
Read more >Node.js - Environment Setup - Tutorialspoint
The installer should set the C:\Program Files\nodejs\bin directory in window's PATH environment variable. Restart any open command prompts for the change to ...
Read more >Location Paths (XSLT)
A location path describes the location of something in an XML document. ... you can focus on the current directory and ignore the...
Read more >NODE_PATH is not set, and node won't find modules installed ...
... if I pass the appropriate environment variable: [orion@mrsa src]$ ... design decision by node and npm upstream which Fedora respects.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
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
(@lacker: Jest does handle NODE_PATH just fine. It also has a
moduleDirectories
option).We do this in
react-boilerplate
with the webpack option, not sure what the up and/or downsides of this approach are:Ref: https://webpack.github.io/docs/configuration.html#resolve-modulesdirectories