I've had a problem with webpack, after run webpack --progress --color --config webpack.dev.js I've had 184 errors like below:
ERROR in ./src/features/settings/SettingsNotificationsPage.tsx 2:0-107
Module not found: Error: Can't resolve 'src/features/settings/components/DashboardSettingsNavigation' in '...'
In my SettingsNotificationsPage i'm import DashbaordSettingsNavigation like here
import { DashboardSettingsNavigation } from "src/features/settings/components/DashboardSettingsNavigation";
and is correct but when webpack try to build my project then many of this import explode.
Can someone tell me what i'm doing wrong?
Thanks for any help!
I get this error when using src/ path in reactjs.
Updating your src/ path with a relative import should do the trick.
then your import became
import { DashboardSettingsNavigation } from "./components/DashboardSettingsNavigation";
based on the fact your import is made from /src/features/settings/SettingsNotificationsPage.tsx
If you add a js/ts configuration setting baseUrl to "src" you should be able to import src/features/... as features/... without the need of using relative import.
Your jsconfig.json/tsconfig.json should be something like
{
"compilerOptions": {
...,
"baseUrl": "src"
},
"include": ["src"]
}
then your import became
import { DashboardSettingsNavigation } from "features/settings/components/DashboardSettingsNavigation";