Skip to content

Relative paths using typescript paths options not being resolved #25

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

Closed
bsunderhus opened this issue Jun 7, 2019 · 1 comment · Fixed by #26
Closed

Relative paths using typescript paths options not being resolved #25

bsunderhus opened this issue Jun 7, 2019 · 1 comment · Fixed by #26
Labels
duplicate This issue or pull request already exists

Comments

@bsunderhus
Copy link

Apparently, the plugin is not able to resolve the types for files that are relative to some path declaration on the typescript configuration.

My tsconfig.json:

{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "~": ["./src/index.tsx"],
      "~/*": ["./src/*"]
    },
    "sourceMap": true,
    "target": "esnext",
    "moduleResolution": "node",
    "noEmit": true,
    "strict": true,
    "isolatedModules": false,
    "esModuleInterop": true,
    "declaration": false,
    "resolveJsonModule": true,
    "experimentalDecorators": true,
    "lib": [
      "dom",
      "esnext"
    ],
    "plugins": [
      {
        "name": "typescript-styled-plugin",
        "tags": [
          "css"
        ]
      },
      {
        "name": "typescript-plugin-css-modules",
        "options": {
          "customMatcher": "\\.(sc|c)ss$",
          "camelCase": "only"
        }
      }
    ],
    "typeRoots": [
      "./node_modules/@types",
      "./@types"
    ]
  },
  "include": [
    "src",
    "webpack"
  ]
}

In my TS file if I import a style by an absolute path, everything works fine, but if the file path is relative to the ~ it simply doesn't work

import globalStyle from '~/styles/style.scss' // Doesn't work at all
import globalStyle2 from '../../styles/style.scss' // Works just fine
  • OS: OSX 10.14.5
  • Browser: Chrome
  • Version: 75
@mrmckeb
Copy link
Owner

mrmckeb commented Jun 9, 2019

Thanks for raising this, and for the detailed reproduction instructions.

This is related to #24, and I'm working on it right now. Hopefully I'll release a fix today.

@mrmckeb mrmckeb closed this as completed Jun 9, 2019
@mrmckeb mrmckeb added the duplicate This issue or pull request already exists label Jun 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants