didierfranc / vscode-react-intellisense

A blank project to get Intellisense for React in Visual Studio Code
MIT License
4 stars 1 forks source link

How to add to existing project #1

Open nonameolsson opened 8 years ago

nonameolsson commented 8 years ago

Great repo!

There is just one thing I don't understand. If I want to this to my existing project, what are the steps? I've added the preinstall script to my package.json.

  "scripts": {
    "preinstall": "npm i typings -D && typings i dt~react dt~react-dom -G -D",
    "dev": "webpack-dev-server --port 3000 --progress --profile --colors",
    "build": "webpack -p --progress --colors"
  },

This is my json.config:

{
  "compilerOptions": {
    "target": "es6",
    "allowSyntheticDefaultImports": true
  },
  "exclude": [
    "node_modules"
  ]
}

In .vscode/settings.json I have the following code:

{
  "files.associations": {
    "*.js": "javascriptreact",
    "*.jsx": "javascriptreact"
  },
  "javascript.validate.enable": true
}

And I have the typings.json in project root, and also the /typings directory.

Is there anything else I need to do? Thanks!

didierfranc commented 8 years ago

You need 3 things to get it working :

The same jsconfig.json and .vscode/settings.json you can find here then add this script to your package.json :

"preinstall": "npm i typings -D && typings i dt~react dt~react-dom -G -D"

and npm install of course 😉

Be careful it's not json.config but jsconfig.json.

ghost commented 8 years ago

Thanks! Of course... Now it seems to work! :)