Help Needed with JS and TypeScript and Wix CLI

Hi Wix Dev Community,

I’m new to using VScode, Wix CLI, and GitHub and have hit some issues with my project. I’m using TypeScript and .tsx files for my components. Here are my problems: Should I be using JS instead of TSX?

  1. Error during npm install:

bash

Copy code

npm ERR! code 1
npm ERR! command failed
npm ERR! command sh -c wix sync-types
  1. Error with sudo npx wix sync-types:

bash

Copy code

✖ Failed to sync the local project to revision 1.0.0
  1. Import Errors in App.tsx:

typescript

Copy code

import LandingPage from './pages/LandingPage';
// Error: Cannot find module './pages/LandingPage' or its type declarations.
  1. Module Errors:

arduino

Copy code

File './pages/BookingCalendar.tsx' is not a module.
// Similar errors for other files

Configuration Files:

wix.json:

json

Copy code

{
  "version": "1.0.0",
  "app": {
    "name": "KeycodeHelpSaaS1",
    "description": "Keycode Help SaaS",
    "platform": "node",
    "environments": {
      "local": {
        "host": "localhost",
        "port": 3000
      }
    }
  },
  "dependencies": {
    "wix": "1.x"
  }
}

package.json:

json

Copy code

{
  "name": "keycodehelpsaas1",
  "version": "1.0.0",
  "scripts": {
    "start": "node index.js",
    "build": "tsc",
    "postinstall": "wix sync-types"
  },
  "dependencies": {
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-router-dom": "^5.2.0",
    "wix": "^1.x"
  },
  "devDependencies": {
    "typescript": "^4.2.4"
  }
}

tsconfig.json:

json

Copy code

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "jsx": "react",
    "esModuleInterop": true,
    "outDir": "./dist"
  },
  "include": [
    "src/**/*.tsx",
    "src/**/*.ts"
  ],
  "exclude": [
    "node_modules"
  ]
}

Help Needed:

  1. Proper setup and use of TypeScript with Wix CLI.
  2. Resolving import errors and module issues in App.tsx.
  3. Tips for integrating these tools effectively.

Thank you for your help!

Best,

Wix only supports JavaScript.

For installing packages and managing your project you can’t use the regular npm and instead should use the wix cli: Working with the Wix CLI

Likewise npx won’t work.