Prerequisites
Make sure you have Node.js version 20 or higher installed on your system.
Installation Steps
Install dependencies
Install all required npm packages:This will install all dependencies including:
- React 17
- TensorFlow.js with MoveNet pose detection
- Webpack 5 and build tools
- TypeScript and Babel
Start development server
Run the development server with hot reload:This command starts the Webpack Dev Server and watches for file changes.
Load the extension in your browser
For Chrome:
- Navigate to
chrome://extensions/ - Enable Developer mode in the top right corner
- Click Load unpacked
- Select the
buildfolder from the project directory
For Firefox:
- Navigate to
about:debugging#/runtime/this-firefox - Click Load Temporary Add-on
- Select the
manifest.jsonfile from thebuildfolder
Build Commands
The project includes several npm scripts for different build tasks:Command Details
npm start- Starts the Webpack development server with hot module replacement. The build output goes to thebuild/directory.npm run build- Creates an optimized production build with minification and source maps disabled.npm run prettier- Formats all JavaScript, TypeScript, JSON, CSS, SCSS, and Markdown files using Prettier.
Build Configuration
The extension uses Webpack 5 for bundling with the following key features:-
Entry Points: Four separate bundles are created:
options.bundle.js- Options page UIpopup.bundle.js- Browser action popupbackground.bundle.js- Service workercontentScript.bundle.js- Content script injected into web pages
- Hot Module Replacement: Enabled for the Options and Popup pages during development (disabled for content script)
-
TypeScript Support: Full TypeScript compilation with
ts-loader - Babel Transpilation: ES6+ features transpiled for browser compatibility
- Asset Handling: Automatic copying of manifest, icons, and stylesheets to the build directory
Development vs Production
The build process automatically adjusts based on theNODE_ENV environment variable:
| Feature | Development | Production |
|---|---|---|
| Source maps | Enabled (cheap-module-source-map) | Disabled |
| Minification | Disabled | Enabled (Terser) |
| Hot reload | Enabled | Disabled |
| Optimization | Minimal | Full |
Troubleshooting
Node.js Version Error
If you see an error about Node.js version compatibility, ensure you’re running Node.js 20 or higher:Build Folder Not Found
If thebuild folder doesn’t exist, make sure you’ve run either npm start or npm run build at least once. The build folder is generated automatically by Webpack.
Camera Permissions
The extension requires webcam access to function. You’ll need to grant camera permissions when first launching the extension.
Next Steps
Now that you have the extension built and running:- Review the Project Structure to understand the codebase organization
- Read the Contributing Guidelines before making changes
- Open the Options page to configure and test the posture tracking feature