wasp icon indicating copy to clipboard operation
wasp copied to clipboard

Fix how we build generated project for production (dev deps)

Open sodic opened this issue 2 years ago • 4 comments

Summary:

  • We have dependencies (things we need when running the code), and we have dev dependencies (things we need when writing the code, e.g., TypeScript).
  • TypeScript is specified as a dev dependency (as it should be), meaning we shouldn't install it when building Wasp for production. The same goes for nodemon, @types packages, etc. One can usually avoid installing dev dependencies by running the command npm install --production (this creates a "production build).
  • Wasp does not make this distinction, it always calls the same code which ends up calling the regular npm install, regardless of the Wasp command at hand (start, build, compile, ...).

To make Wasp production ready, we must:

  • Start treating dev dependencies differently than regular dependencies
  • Put each dependency into the appropriate category (e.g. TypeScript is a dev dependency, Express is a regular dependency)
  • Ensure our code can run without any dev dependencies (e.g., we currently don't compile TypeScript when building for production)

While we're at it, we should probably take care of #456 too.

sodic avatar Dec 22 '22 10:12 sodic

Is this blocked by the restructuring, or can we go after it right now?

Martinsos avatar Jun 06 '23 12:06 Martinsos

I'd say it's blocked.

sodic avatar Jun 16 '23 12:06 sodic

@sodic is this now solved after 0.12.0?

infomiho avatar Jul 25 '24 11:07 infomiho

I'm not sure, some parts of it may be fixed, but I think not (I think we still treat them the same way when building for production).

Most (if not all) points are still applicable, I'd say.

sodic avatar Aug 01 '24 09:08 sodic