Skip to content

jsconfig.json validate module import seem to not find default 'index' file path #36699

Closed

Description

@Jancat
  • VSCode Version: Code 1.17.2 (b813d12, 2017-10-16T13:47:41.889Z)
  • OS Version: Darwin x64 16.7.0

My jsconfig.json :

{
  "compilerOptions": {
    "target": "ES6",
    "checkJs": true,
    "allowSyntheticDefaultImports": true,
    "jsx": "react-native"
  },
  
  "exclude": [
    "node_modules"
  ]
}

foo.js:

import { ApplicationStyles } from "app/themes"

The build-in js validator hint [js] Cannot find module 'app/themes'.

And I want to import app/themes/index default without the index suffix and validator error.

How can I config the jsconfig.json to achieve this?

Activity

  1. added
    javascript
    on Oct 22, 2017
  2. added
    *question
    on Oct 23, 2017
  3. mjbvz commented on Oct 23, 2017

    @mjbvz
    Contributor

    You need to add "module": "commonjs" to your compilerOptions. This allows index files to be resolved when referencing the parent directory

  4. locked and limited conversation to collaborators on Dec 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

*questionjavascript

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions