AdGuardHome/client_v2/webpack.dev.js
Ildar Kamalov 853e12aabf Pull request #2447: ADG-10293 add general settings page
Merge in DNS/adguard-home from ADG-10293 to ADG-10291

Squashed commit of the following:

commit d488e3d3ce
Author: Ildar Kamalov <ik@adguard.com>
Date:   Wed Aug 13 19:40:42 2025 +0300

    fix language change

commit 2c22687bae
Author: Ildar Kamalov <ik@adguard.com>
Date:   Wed Aug 13 19:38:09 2025 +0300

    fix mobile links

commit 372eddc1e7
Author: Ildar Kamalov <ik@adguard.com>
Date:   Wed Aug 13 11:53:58 2025 +0300

    fix lock

commit 3f6d759b7f
Author: Ildar Kamalov <ik@adguard.com>
Date:   Tue Aug 12 16:40:31 2025 +0300

    fix placeholder

commit 507631ab71
Author: Ildar Kamalov <ik@adguard.com>
Date:   Tue Aug 12 16:15:57 2025 +0300

    use batch

commit e495a5585c
Author: Ildar Kamalov <ik@adguard.com>
Date:   Tue Aug 12 16:13:13 2025 +0300

    review fix

commit 2ba671b408
Author: Ildar Kamalov <ik@adguard.com>
Date:   Tue Aug 12 10:45:00 2025 +0300

    fix

commit 6f696238a0
Author: Ildar Kamalov <ik@adguard.com>
Date:   Mon Aug 11 18:38:28 2025 +0300

    fix language change

commit 8206f3f885
Author: Ildar Kamalov <ik@adguard.com>
Date:   Mon Aug 11 14:54:58 2025 +0300

    fix custom radio

commit 0920a51c4a
Author: Ildar Kamalov <ik@adguard.com>
Date:   Mon Aug 11 14:30:26 2025 +0300

    fix

commit c7ca1e8eaf
Author: Ildar Kamalov <ik@adguard.com>
Date:   Mon Aug 11 14:25:16 2025 +0300

    fix ids

commit 7ecd6426d9
Author: Ildar Kamalov <ik@adguard.com>
Date:   Mon Aug 11 13:56:29 2025 +0300

    fix constant import

commit 246f1277b8
Author: Ildar Kamalov <ik@adguard.com>
Date:   Mon Aug 11 13:46:11 2025 +0300

    fix version

commit 0224f567e6
Author: Ildar Kamalov <ik@adguard.com>
Date:   Mon Aug 11 13:34:29 2025 +0300

    fix version

commit 75c9caffbd
Author: Ildar Kamalov <ik@adguard.com>
Date:   Mon Aug 11 13:14:01 2025 +0300

    lint fix

commit d0cf6ad5ab
Author: Ildar Kamalov <ik@adguard.com>
Date:   Mon Aug 11 12:40:49 2025 +0300

    lint fix

commit 87eb68e519
Author: Ildar Kamalov <ik@adguard.com>
Date:   Mon Aug 11 12:06:35 2025 +0300

    use npm

commit 7df7d60ec9
Author: Ildar Kamalov <ik@adguard.com>
Date:   Mon Aug 11 11:23:00 2025 +0300

    rm unused

commit c285ea978a
Author: Ildar Kamalov <ik@adguard.com>
Date:   Mon Aug 11 10:42:39 2025 +0300

    fix

commit d00f1e12b3
Author: Ildar Kamalov <ik@adguard.com>
Date:   Mon Aug 11 09:43:35 2025 +0300

    fix

... and 2 more commits
2025-08-14 12:09:54 +03:00

55 lines
1.4 KiB
JavaScript

import { merge } from 'webpack-merge';
import yaml from 'js-yaml';
import fs from 'fs';
import { BASE_URL } from './constants.js';
import common from './webpack.common.js';
const ZERO_HOST = '0.0.0.0';
const LOCALHOST = '127.0.0.1';
const DEFAULT_PORT = 80;
/**
* Get document, or throw exception on error
* @returns {{bind_host: string, bind_port: number}}
*/
const importConfig = () => {
try {
const doc = yaml.safeLoad(fs.readFileSync('../AdguardHome.yaml', 'utf8'));
const { bind_host, bind_port } = doc;
return {
bind_host,
bind_port,
};
} catch (e) {
console.error(e);
return {
bind_host: ZERO_HOST,
bind_port: DEFAULT_PORT,
};
}
};
const getDevServerConfig = (proxyUrl = BASE_URL) => {
const { bind_host: host, bind_port: port } = importConfig();
const { DEV_SERVER_PORT } = process.env;
const devServerHost = host === ZERO_HOST ? LOCALHOST : host;
const devServerPort = DEV_SERVER_PORT || port + 8000;
return {
hot: true,
open: true,
host: devServerHost,
port: devServerPort,
proxy: {
[proxyUrl]: `http://${devServerHost}:${port}`,
},
};
};
export default merge(common, {
devtool: 'eval-source-map',
...(process.env.WEBPACK_DEV_SERVER ? { devServer: getDevServerConfig(BASE_URL) } : undefined),
});