-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
Support src directory as webpack resolve.modules #3596
Comments
You can already do this by putting
in a file called For a more permanent solution you can watch #1333. |
@gaearon Thank you for the solution you provided above, But working with create-react-app and react-scripts, these |
@haraldrudell you can place the .env file in the root of you application (next to package.json). It will be resolved automagically by the scripts. Also you can put any other REACT_APP_{yourvariable} prepended variables in the .env file and they will be accessible in your src using process.env.REACT_APP_{yourvariable} in your code. |
Much code that is pasted into Create React App assumes that the src directory is resolved so that filename and module references becomes the same.
people want to write
import 'components/Accordion'
instead of
import './components/Accordion'
because then at some point, components could be a module.
Drawback is that the thing won’t run no more unless using webpack resolver.
The suggestion is to modify webpack.config.js and such to:
(using the paths object, obviously)
from:
The text was updated successfully, but these errors were encountered: