question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

File replacement for prod release not working

See original GitHub issue

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

NA

Description

Need to replace index.html with index.prod.html when build with ng build

"configurations": {
            "production": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                },
                {
                  "replace": "src/index.html",
                  "with": "src/index.prod.html"
                }
              ],
              "outputHashing": "all"
            },

πŸ”₯ Exception or Error


Schema validation failed with the following errors:
  Data path "/fileReplacements/1" must have required property 'src'.
  Data path "/fileReplacements/1/replace" must match pattern "\.(([cm]?j|t)sx?|json)$".
  Data path "/fileReplacements/1" must match exactly one schema in oneOf.de>

🌍 Your Environment


Angular CLI: 13.1.4
Node: 16.15.0
Package Manager: npm 8.5.5
OS: win32 x64

Angular: 13.1.3
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.1301.4
@angular-devkit/build-angular      13.3.5
@angular-devkit/core               13.1.4
@angular-devkit/schematics         13.1.4
@angular/cdk                       13.3.6
@angular/cli                       13.1.4
@angular/material                  13.3.6
@angular/material-moment-adapter   13.3.6
@schematics/angular                13.1.4
rxjs                               7.4.0
typescript                         4.5.5

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
alan-agius4commented, Jul 12, 2022

You can use specify the output name when using the index output option.

{
    "index": {"input": "src/index.prod.html", "output": "index.html"
}

fileReplacements is intended to only replace files that are in the TypeScript program.

0reactions
angular-automatic-lock-bot[bot]commented, Aug 12, 2022

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[9.0.1] ng build file replacements don't work after update to v9
I have a `config.js` file which has some settings in it, and it should be replaced by a production `config.js` when performing a...
Read more >
Unable to run release application in elixir after creating ...
@TheBrofessor I tried with removing url option in prod.exs but still nothing happened it does not listen to port 4000. I have tried...
Read more >
prod --release build no longer works - Ionic Forum
Hello guys, I have a new problem with --prod --release build command. When I try to build an apk file using this command...
Read more >
Phoenix Umbrella Prod Release Doesn't Start - Elixir Forum
seems like it's running, but I can't navigate to the landing page in my browser. Here's how I have everything configured: Elixir is...
Read more >
Prepare your app for release - Android Developers
Learn how to build a signed, release-ready APK. This process is the same for all Android apps.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found