restore support for local dev using a non-local url
This commit is contained in:
parent
eaed8f2cec
commit
0d1c993dd2
3 changed files with 2 additions and 17 deletions
|
@ -323,19 +323,16 @@ export class ClientServerService {
|
|||
done();
|
||||
});
|
||||
} else {
|
||||
const configUrl = new URL(this.config.url);
|
||||
const urlOriginWithoutPort = configUrl.origin.replace(/:\d+$/, '');
|
||||
|
||||
const port = (process.env.VITE_PORT ?? '5173');
|
||||
fastify.register(fastifyProxy, {
|
||||
upstream: urlOriginWithoutPort + ':' + port,
|
||||
upstream: `http://localhost:${port}`,
|
||||
prefix: '/vite',
|
||||
rewritePrefix: '/vite',
|
||||
});
|
||||
|
||||
const embedPort = (process.env.EMBED_VITE_PORT ?? '5174');
|
||||
fastify.register(fastifyProxy, {
|
||||
upstream: urlOriginWithoutPort + ':' + embedPort,
|
||||
upstream: `http://localhost:${embedPort}`,
|
||||
prefix: '/embed_vite',
|
||||
rewritePrefix: '/embed_vite',
|
||||
});
|
||||
|
|
|
@ -2,8 +2,6 @@ import path from 'path';
|
|||
import pluginVue from '@vitejs/plugin-vue';
|
||||
import { type UserConfig, defineConfig } from 'vite';
|
||||
import { localesVersion } from '../../locales/version.js';
|
||||
import * as yaml from 'js-yaml';
|
||||
import { promises as fsp } from 'fs';
|
||||
|
||||
import locales from '../../locales/index.js';
|
||||
import meta from '../../package.json';
|
||||
|
@ -11,9 +9,6 @@ import packageInfo from './package.json' with { type: 'json' };
|
|||
import pluginJson5 from './vite.json5.js';
|
||||
import { pluginReplaceIcons } from '../frontend/vite.replaceIcons.js';
|
||||
|
||||
const url = process.env.NODE_ENV === 'development' ? yaml.load(await fsp.readFile('../../.config/default.yml', 'utf-8')).url : null;
|
||||
const host = url ? (new URL(url)).hostname : undefined;
|
||||
|
||||
const extensions = ['.ts', '.tsx', '.js', '.jsx', '.mjs', '.json', '.json5', '.svg', '.sass', '.scss', '.css', '.vue'];
|
||||
|
||||
/**
|
||||
|
@ -69,7 +64,6 @@ export function getConfig(): UserConfig {
|
|||
base: '/embed_vite/',
|
||||
|
||||
server: {
|
||||
host,
|
||||
port: 5174,
|
||||
hmr: {
|
||||
// バックエンド経由での起動時、Viteは5174経由でアセットを参照していると思い込んでいるが実際は3000から配信される
|
||||
|
|
|
@ -3,8 +3,6 @@ import pluginReplace from '@rollup/plugin-replace';
|
|||
import pluginVue from '@vitejs/plugin-vue';
|
||||
import { type UserConfig, defineConfig } from 'vite';
|
||||
import { localesVersion } from '../../locales/version.js';
|
||||
import * as yaml from 'js-yaml';
|
||||
import { promises as fsp } from 'fs';
|
||||
|
||||
import locales from '../../locales/index.js';
|
||||
import meta from '../../package.json';
|
||||
|
@ -13,9 +11,6 @@ import pluginUnwindCssModuleClassName from './lib/rollup-plugin-unwind-css-modul
|
|||
import pluginJson5 from './vite.json5.js';
|
||||
import { pluginReplaceIcons } from './vite.replaceIcons.js';
|
||||
|
||||
const url = process.env.NODE_ENV === 'development' ? yaml.load(await fsp.readFile('../../.config/default.yml', 'utf-8')).url : null;
|
||||
const host = url ? (new URL(url)).hostname : undefined;
|
||||
|
||||
const extensions = ['.ts', '.tsx', '.js', '.jsx', '.mjs', '.json', '.json5', '.svg', '.sass', '.scss', '.css', '.vue', '.wasm'];
|
||||
|
||||
/**
|
||||
|
@ -82,7 +77,6 @@ export function getConfig(): UserConfig {
|
|||
base: '/vite/',
|
||||
|
||||
server: {
|
||||
host,
|
||||
port: 5173,
|
||||
hmr: {
|
||||
// バックエンド経由での起動時、Viteは5173経由でアセットを参照していると思い込んでいるが実際は3000から配信される
|
||||
|
|
Loading…
Add table
Reference in a new issue