37 lines
1.1 KiB
TypeScript
37 lines
1.1 KiB
TypeScript
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()],
|
||
});
|