You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 26, 2019. It is now read-only.
I solved this issue by forking this repository, and update the webpack config. Just add paths.appSrc to the resolve.modules config (in both prod and dev) would work:
modules: ['node_modules', paths.appNodeModules, paths.appSrc].concat(
// It is guaranteed to exist because we tweak it in `env.js`
process.env.NODE_PATH.split(path.delimiter).filter(Boolean)
),
So that you don't need to eject, just keep your fork in sync time to time. Hope that helps :-)
@zhenwenc So far as I can tell that achieves the same result as setting NODE_PATH=src in the .env file. process.env.NODE_PATH.split(path.delimiter).filter(Boolean)
I still don't have a solution, btw... putting code in src/node_modules is asking for trouble, so I didn't do this in the end.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Fresh app. Then:
And change
src/index.tsx
to
Results in:
This is one way to get absolute imports with plain
create-react-app
, I tested the same process with that and it builds fine.The
.env
file itself is definitely loaded, since I can setPORT
, for example.Related:
#98
facebook/create-react-app#741
facebook/create-react-app#1712
(possibly) facebook/create-react-app#2230
The text was updated successfully, but these errors were encountered: