tsconfig-paths-webpack-plugin icon indicating copy to clipboard operation
tsconfig-paths-webpack-plugin copied to clipboard

TypeScript JavaScript interoperability problem

Open xiaoxiangmoe opened this issue 7 years ago • 1 comments
trafficstars

I'm using create-react-app-typescript and my tsconfig file as below:

{
  "compilerOptions": {
    "baseUrl": ".",
    "outDir": "build/dist",
    "module": "esnext",
    "target": "es5",
    "lib": ["esnext", "dom"],
    "sourceMap": true,
    "allowJs": true,
    "jsx": "react",
    "moduleResolution": "node",
    "rootDir": "src",
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "noImplicitReturns": true,
    "noImplicitThis": true,
    "noImplicitAny": true,
    "strictNullChecks": true,
    "suppressImplicitAnyIndexErrors": true,
    "noUnusedLocals": false,
    "resolveJsonModule": false,
    "experimentalDecorators": true,
    "paths": {
      "@/*":["src/*"]
    }
  },
  "exclude": [
    "node_modules",
    "build",
    "scripts",
    "acceptance-tests",
    "webpack",
    "jest",
    "src/setupTests.ts"
  ]
}

If I have src/components/Foo/index.js and src/components/Foo/index.d.ts. I can't use import Foo from "@/components/Foo"; in my ts file.

xiaoxiangmoe avatar Sep 27 '18 09:09 xiaoxiangmoe

@xiaoxiangmoe could you check to make sure your extensions config is in sync between webpack and the plugin as mentioned in this comment?

jonaskello avatar Sep 29 '18 12:09 jonaskello