Jan
22
17 hours ago
started
started time in 7 minutes ago
started
started time in 14 minutes ago
started
started time in 54 minutes ago
started
started time in 2 hours ago
Activity icon
issue

ImanMh issue facebook/create-react-app

ImanMh
ImanMh

Absolute imports do not work

Describe the bug

Absolute imports do not work

Did you try recovering your dependencies?

yes

npm v8.3.0

Which terms did you search for in User Guide?

(Write your answer here if relevant.)

Environment

Environment Info:

current version of create-react-app: 5.0.0 running from /Users/iman/.npm/_npx/c67e74de0542c87c/node_modules/create-react-app

System: OS: macOS 11.6 CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @2.60GHz Binaries: Node: 16.8.0 - ~/.nvm/versions/node/v16.8.0/bin/node Yarn: 1.22.17 - ~/.nvm/versions/node/v16.8.0/bin/yarn npm: 8.3.0 - ~/.nvm/versions/node/v16.8.0/bin/npm Browsers: Chrome: 97.0.4692.71 Edge: Not Found Firefox: 96.0.1 Safari: 14.1.2 npmPackages: react: ^17.0.2 => 17.0.2 react-dom: ^17.0.2 => 17.0.2 react-scripts: 5.0.0 => 5.0.0 npmGlobalPackages: create-react-app: Not Found

Steps to reproduce

  1. npx create-react-app my-app
  2. cd my-app
  3. touch jsconfig.json
  4. vim jsconfig.json
  5. add these lines:
{
  "compilerOptions": {
    "baseUrl": "src"
  },
  "include": ["src"]
}
  1. mkdir src/utils
  2. echo "export const a = 1;" >> src/utils/one.js
  3. vim app.js
  4. add this at the top of the file: import x from 'utils/one';
  5. npm start
  6. will fail to compile

Expected behavior

According to this document it should work: https://create-react-app.dev/docs/importing-a-component#absolute-imports

Actual behavior

to compile successfully.

Activity icon
issue

ImanMh issue comment facebook/create-react-app

ImanMh
ImanMh

Absolute Import not work when create new file

Hi, I got this problem in VS code, only within this project. When I created a new file, I can't use Absolute Import Path, I have to restart the VS Code or re-run npm start This is the new file image

And here, same file but after restart VS Code image

It is time-consuming when I have to re-run the project or restart VS code every time when I create a new file. Please help me out Here is my tsconfig.json image

ImanMh
ImanMh

don't you have any issues with the older files? I have the same issue with all files.

Activity icon
fork

Shirley-PH forked facebook/create-react-app

⚡ Set up a modern web app by running one command.
Shirley-PH MIT License Updated
fork time in 5 hours ago
Activity icon
issue

jalalabdalaJalalabdallah issue facebook/create-react-app

jalalabdalaJalalabdallah
jalalabdalaJalalabdallah

GreenEnergy

npx create-react-app my-app cd my-app npm start

Previous