arm-core/web/rsbuild.config.ts
2026-10-08 18:09:07 +03:00

37 lines
1.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { defineConfig, loadEnv } from '@rsbuild/core';
import { pluginReact } from '@rsbuild/plugin-react';
const { publicVars, rawPublicVars } = loadEnv({prefixes: ['REACT_APP_']});
export default defineConfig({
server: {
base: (rawPublicVars['REACT_APP_ROOT_PATH'] !== undefined) ? rawPublicVars['REACT_APP_ROOT_PATH'] : '/',
proxy: {
// dev: запросы /api идут на arm-core с того же источника — без CORS, Content-Disposition читается (design D-5)
'/api': process.env.ARM_CORE_URL ?? 'http://localhost:8000',
},
},
output: {
filename: {
js: '[name]_script.[contenthash:8].js',
css: '[name]_style.[contenthash:8].css',
},
distPath: {
favicon: 'static/image',
},
assetPrefix: (rawPublicVars['REACT_APP_ROOT_PATH'] !== undefined) ? rawPublicVars['REACT_APP_ROOT_PATH'] : './'
},
html: {
template: './public/index.html',
favicon: './src/assets/favicon.ico',
},
source: {
include: [{ not: /[\\/]core-js[\\/]/ }],
define: {
...publicVars,
'process.env': JSON.stringify(rawPublicVars),
}
},
plugins: [pluginReact()],
});