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?
- Error during
npm install
:
bash
Copy code
npm ERR! code 1
npm ERR! command failed
npm ERR! command sh -c wix sync-types
- Error with
sudo npx wix sync-types
:
bash
Copy code
✖ Failed to sync the local project to revision 1.0.0
- Import Errors in
App.tsx
:
typescript
Copy code
import LandingPage from './pages/LandingPage';
// Error: Cannot find module './pages/LandingPage' or its type declarations.
- 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:
- Proper setup and use of TypeScript with Wix CLI.
- Resolving import errors and module issues in
App.tsx
. - Tips for integrating these tools effectively.
Thank you for your help!
Best,