frontend: Don't copy resources to language dirs

Since 355e89ce5, the frontend references resources via root-relative URLs.
This means that `resources` dirs in the language dirs are no longer
accessed and can be removed.

Achieve this by defining a specific `assets` production config that
doesn't include `src/resources`.

As of fd35c8f4a, this shrinks the frontend size by 55% (279M -> 124M).

Also, the nginx location configs now can be simplified.
This commit is contained in:
Erik Arvstedt
2022-07-11 20:18:10 +02:00
parent 249a65bb57
commit 22def9b01c
6 changed files with 9 additions and 15 deletions

View File

@@ -170,6 +170,10 @@
},
"configurations": {
"production": {
"assets": [
"src/favicon.ico",
"src/robots.txt"
],
"fileReplacements": [
{
"replace": "src/environments/environment.ts",

View File

@@ -34,7 +34,7 @@
"start:local-staging": "npm run generate-config && npm run sync-assets-dev && npm run ng -- serve -c local-staging",
"start:mixed": "npm run generate-config && npm run sync-assets-dev && npm run ng -- serve -c mixed",
"build": "npm run generate-config && npm run ng -- build --configuration production --localize && npm run sync-assets && npm run build-mempool.js",
"sync-assets": "node sync-assets.js && rsync -av ./dist/mempool/browser/en-US/resources ./dist/mempool/browser/resources",
"sync-assets": "rsync -av ./src/resources ./dist/mempool/browser && node sync-assets.js",
"sync-assets-dev": "node sync-assets.js dev",
"generate-config": "node generate-config.js",
"build-mempool.js": "npm run build-mempool-js && npm run build-mempool-liquid-js && npm run build-mempool-bisq-js",

View File

@@ -4,7 +4,7 @@ var fs = require('fs');
const CONFIG_FILE_NAME = 'mempool-frontend-config.json';
let configContent = {};
var PATH = 'dist/mempool/browser/en-US/resources/';
var PATH = 'dist/mempool/browser/resources/';
if (process.argv[2] && process.argv[2] === 'dev') {
PATH = 'src/resources/';
}