Eslint + typescript paths aliasing - Unable to resolve path to module

Viewed 2249

I add typescript config for paths:

{
 //.....

 "moduleResolution": "node",
{
  "baseUrl": "app",
  "paths": {
  "@app/*": ["*"],
  "@folder/*": ["folder/*"],

  //Other paths
},

}

Added configuration to webpack:

  resolve: {
  extensions: [".tsx", ".ts", ".js", ".jsx", ".css", ".json"],
  alias: {
    "@app":path.resolve(__dirname + "../", "app"),
    "@services":path.resolve(__dirname + "../app", "folder")
  },
  modules: [
    "node_modules", path.resolve(process.cwd(), "app")
  ],
  plugins: [
    new TsConfigPathsPlugin({
      configFile: "../tsconfig.json"
    }),
  ],
},

And here is my .eslint file:

"settings": {
"import/resolver": {
  "node": {
    "paths": [
      "app"
    ],
    "extensions": [
      ".ts",
      ".tsx",
      ".jest.tsx",
      ".d.ts"
    ]
  }
}

After that I try import somthing like this:

import {component} from "@folder/component";

Everything is assembled, the compiler generates no errors But I get error in eslint:

ESLint: Unable to resolve path to module '@folder/component'.(import/no-unresolved)

I've been trying to figure this out for the third day The customer does not want to install additional plugins I would be very grateful for your help!

1 Answers
Related