Scripts
ESBO Web includes several npm scripts for common development tasks. All scripts are defined inpackage.json.
Available Scripts
dev
Starts the development server with hot module replacement (HMR).
- Launches Vite development server
- Enables Fast Refresh for React components
- Serves the application at
http://localhost:5173 - Watches for file changes and updates instantly
- Provides detailed error messages in the browser
- During active development
- When testing changes locally
- For rapid prototyping
The development build is not optimized and includes debugging tools. Always use
build for production.build
Creates an optimized production build.
- Compiles and bundles all source files
- Minifies JavaScript and CSS
- Optimizes assets (images, fonts, etc.)
- Generates source maps for debugging
- Outputs to the
dist/directory - Tree-shakes unused code
- Splits code into optimized chunks
- Before deploying to production
- To test production build performance
- For bundle size analysis
dist/index.html- Entry HTML filedist/assets/- Optimized JavaScript, CSS, and static assets- Hashed filenames for cache busting
lint
Runs ESLint to check code quality and identify issues.
- Analyzes JavaScript and JSX files
- Checks for syntax errors
- Enforces code style rules
- Validates React Hooks usage
- Ensures Fast Refresh compatibility
- Reports unused variables and imports
- Before committing code
- As part of CI/CD pipeline
- When debugging unexpected behavior
- Before code reviews
preview
Serves the production build locally for testing.
- Serves the built files from
dist/ - Runs a local static file server
- Mimics production environment
- Available at
http://localhost:4173
- After running
build - To test production build locally
- To verify optimizations work correctly
- Before deploying to production
You must run
npm run build before using preview. The preview command does not build the project.Script Workflow
Typical development workflow:Common Script Combinations
Pre-commit Check
Full Build and Preview
CI/CD Integration
Example GitHub Actions workflow:Troubleshooting
Port Already in Use
If the default port is taken:Build Errors
-
Clear node_modules and reinstall:
-
Check for TypeScript/ESLint errors first: