digitalbazaar / digitalbazaar/bedrock-webpack

Improve defines and "production" modes.

Open
#25 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
JavaScript
Stars
1
Forks
2
Avg merge
2d 41m
Merged PRs (30d)
1

Description

Issue from https://github.com/digitalbazaar/bedrock-webpack/pull/24.

The "production" situation is difficult to understand at the moment. Looking for suggestions on how it should be improved. The server code itself can be run with NODE_ENV=production, bedrock-views has a --bundle-mode option, and bedrock-webpack has a --webpack-mode option.

Right now, something like node app.js bundle --bundle-mode production will cause bedrock-views to set an optimization flag and bedrock-webpack to go into production mode and define process.env.NODE_ENV=production for the frontend. That can be a bit confusing as the frontend isn't Node.js! It's unclear if the wider community has a standard for that type of define.

Setting NODE_ENV=production when building just sets that for the builder itself. It doesn't currently pass that through to the frontend code. That was done to give control on what optimizations go into the output and allow for building of production code while retaining debugability. Some modern source map features reduce the need for that.

It might be better to use a different "define" or config value system for these frontend uses.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing how bedrock-views handles --bundle-mode and how bedrock-webpack handles --webpack-mode and NODE_ENV. Clarify the frontend define or configuration convention, then define consistent behavior for production builds and document the agreed result.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, webpack
Domain
build-system, frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.