Ich habe einige Probleme mit Webpack und meine API url. Ich habe einen Build mit Jenkins, die meine app auf zwei ServerWebpack dynamische URL api
Ich habe zwei Backend url (das gleiche wie Frontend url) bereitstellen:
- Recette: 12.122.125.208
- Prod: 12.122.125.209
Meine webpack config:
build: {
env: require('./prod.env'),
index: path.resolve(__dirname, '../dist/index.html'),
assetsRoot: path.resolve(__dirname, '../dist'),
assetsSubDirectory: 'static',
assetsPublicPath: '/',
productionSourceMap: true,
productionGzip: false,
productionGzipExtensions: ['js', 'css'],
bundleAnalyzerReport: process.env.npm_config_report
},
Übe d.env Datei:
module.exports = {
NODE_ENV: '"production"',
URL_API: '"http://12.122.125.208/api/"',
};
Es ist möglich, dynamische URL zu haben, die auf den gegenwärtigen URL so etwas wie:
const = BASE_URL;
URL_API: BASE_URL + '/api/"',
Damit kann ich eine Zeit für meine zwei Server bereitstellen
Wie kann Ich mach das?
Danke.