mgechev / mgechev/angular-seed

Compiled env.config.js

Open
#2,218 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
4.5k
Forks
1.4k
PR merge metrics
No merged PRs in 30d

Description

Minko, I ran into an issue where the env.config.ts is being compiled into JS, and when a dev reload happens, the ENV_CONFIG value stops getting replaced. Or more specifically, the compiled JS version without the replacement seems to be getting copied over to /dist during the asset copy. So an error is thrown since `JSON.parse('<%= ENV_CONFIG %>');` is invalid.

I found an older issue #1747 which seems to be the same problem. In order to solve it, I had to modify `build.assets.dev.ts` to add:
```
'!' + join(Config.APP_SRC, '**', 'env.config.js'),
'!' + join(Config.APP_SRC, '**', 'env.config.js.map'),
```

I'm not sure why this suddenly started being a problem, but I thought I would mention it again in case the additional exclusions are something you want to include in the seed.

Contributor guide

Open the contributing guide

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 reading build.assets.dev.ts and tracing how env.config.ts, env.config.js, and its source map are copied into /dist during dev reloads. Compare the existing asset exclusions with the issue's proposed patterns; done means the compiled files no longer overwrite the replaced configuration and the dev reload no longer throws the JSON.parse error.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.