Skip to content
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

import from baseUrl not working #288

Open
noscripter opened this issue Jul 2, 2019 · 4 comments
Open

import from baseUrl not working #288

noscripter opened this issue Jul 2, 2019 · 4 comments

Comments

@noscripter
Copy link

noscripter commented Jul 2, 2019

My tsconfig.json is as following:

{
  "compilerOptions": {
    "strictNullChecks": true,
    "moduleResolution": "node",
    "experimentalDecorators": true,
    "outDir": "build",
    "allowJs": true,
    "target": "es5",
    "jsx": "react",
    "skipLibCheck": true,
    "allowSyntheticDefaultImports": true,
    "sourceMap": true,
    "baseUrl": "./src/",
    "paths": {
      "util/*": [ "util/*" ],
      "constant/*": [ "constant/*" ]
    }
  },
  "include": [
    "src/**/*.tsx?"
  ],
  "exclude": [
    "src/vmax*",
    "src/util/event.js",
    "node_modules",
    "**/__snapshots__/*",
    "**/*.snap",
    "**/*.test.jsx?"
  ]
}

And my project folder structure is as following:

src
    -  util
        -  formItemValidate.ts
    -  app
         -  alarm
               -  component
                   -  TableForm.tsx

Now I'm importing formItemValidate.ts in TableForm.tsx:

import * as FormItemValidate from 'util/formItemValidate'

But tsuquyomi is reporting the following errors:

Cannot find module 'util/formItemValidate'.

And my vim configuration for tsuquyomi is:

  "Quramy/tsuquyomi
    autocmd FileType typescript setlocal completeopt-=menu
    let g:tsuquyomi_completion_detail = 1
    autocmd FileType typescript setlocal completeopt+=menu,preview
    let g:syntastic_typescript_checkers = ['tsuquyomi'] " You shouldn't use 'tsc' checker.
    let g:tsuquyomi_baseurl_import_path = 1

I ran the following command to check its settings too:

let g:tsuquyomi_baseurl_import_path

the result is 1

and ran

let g:tsuquyomi_shortest_import_path

the result is 0.

Can anyone help me debug this issue or give some hints about resolving it? Thanks in advance.

@noscripter noscripter changed the title baseUrl not working import from baseUrl not working Jul 2, 2019
@noscripter
Copy link
Author

cc @Quramy @gurdiga

@noscripter
Copy link
Author

related PR #205

@noscripter
Copy link
Author

Plus, my webpack configuration using awesome-typescript-loader won't report the module not found error so I think is solely related to this plugin.

@noscripter
Copy link
Author

Searching through the source code, I found a workaround for this problem by adding the following configuration to $VIMRC:

let g:tsuquyomi_ignore_missing_modules = 1

Related source code is: https://github.com/Quramy/tsuquyomi/blob/v0.8.0/autoload/tsuquyomi.vim#L563

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant