-
-
Notifications
You must be signed in to change notification settings - Fork 27k
react-scripts 4.0.1 absolute components import doesn't work #10148
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
Comments
|
Replace "compilerOptions": {
"baseUrl": "./"
} This could be more explicit in the changelog. |
I used
|
Got it working. Try this in
Found here: |
None of those work for me in 2021 with |
From what I can tell, this is an issue with the
when Ejecting CRA and modifying webpack.config.js & versions demonstrates this:
The plugin upgrade requires modifications to webpack.config.js to work, so as far as I can tell, there is no workaround for non-ejected |
Works for me with react-scripts@5.0.0 (ts, default configuration) |
Describe the bug
Absolute components import doesn't work in 4.0.1 CRA version.
For example:
I get this error `Module not found: Can't resolve 'components/Todo' in '.../cra-project/src'
Folder
components
is nested tosrc
folder.The file
.env
was added in the project root..env
file contentWhen I change
react-scripts
version from4.0.1
to3.4.4
absolute imports work fine.Did you try recovering your dependencies?
Yes.
Environment
Environment Info:
current version of create-react-app: 4.0.1
running from /home/sergey-sedykh/.npm/_npx/12865/lib/node_modules/create-react-app
System:
OS: Linux 5.4 Ubuntu 18.04.3 LTS (Bionic Beaver)
CPU: (4) x64 Intel(R) Core(TM) i5-3330 CPU @ 3.00GHz
Binaries:
Node: 14.6.0 - /usr/local/bin/node
Yarn: 1.22.4 - /usr/bin/yarn
npm: 6.14.6 - /usr/local/bin/npm
Browsers:
Chrome: 85.0.4183.121
Firefox: 83.0
npmPackages:
react: ^17.0.1 => 17.0.1
react-dom: ^17.0.1 => 17.0.1
react-scripts: 4.0.1 => 4.0.1
npmGlobalPackages:
create-react-app: Not Found
Steps to reproduce
.env
in the project root..env
file next contentNODE_PATH=src/
Expected behavior
Absolute module imports should work.
The text was updated successfully, but these errors were encountered: