Skip to main content

Environment

A project can be built in 2 modes: development and production.

Implementation and configuration can be viewed in files build.js and config.js mentioned in project structure.

Difference between modes:

development

  • UI components are built with fully lazy-loading approach, and no minified code.
  • Useful for testing or debugging thank to well-formatted discrete scripts which are easy to observe.

production

  • UI components are built with bundling approach, and minified code.
  • Not bundle the whole codebase, but separately for each UI component with its own dependencies.
  • Each bundled UI component is still ready for lazy-loading on demand.
  • Enhance loading performance since code is minified, bundled, and required on demand.
  • Ready for deloying on production server.

Commands for each mode

By default, without option flag env, mode is set as development.

When set env=prod, the project is built with mode production.

Start project

npx binhend start frontend env=prod
node frontend/server.js env=prod

Build project

npx binhend build frontend env=prod
node frontend/build.js env=prod