mirror of
https://github.com/lordmathis/lemma.git
synced 2025-11-06 16:04:23 +00:00
Set api url for prod
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
const API_BASE_URL = 'http://localhost:8080/api/v1';
|
const API_BASE_URL = window.API_BASE_URL;
|
||||||
|
|
||||||
export const fetchFileList = async () => {
|
export const fetchFileList = async () => {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -1,39 +1,49 @@
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||||
|
const webpack = require('webpack');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = (env, argv) => {
|
||||||
entry: './src/index.js',
|
const isProduction = argv.mode === 'production';
|
||||||
output: {
|
|
||||||
path: path.resolve(__dirname, 'dist'),
|
return {
|
||||||
filename: 'bundle.js',
|
entry: './src/index.js',
|
||||||
},
|
output: {
|
||||||
module: {
|
path: path.resolve(__dirname, 'dist'),
|
||||||
rules: [
|
filename: 'bundle.js',
|
||||||
{
|
|
||||||
test: /\.(js|jsx)$/,
|
|
||||||
exclude: /node_modules/,
|
|
||||||
use: ['babel-loader'],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.scss$/,
|
|
||||||
use: ['style-loader', 'css-loader', 'sass-loader'],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.css$/,
|
|
||||||
use: ['style-loader', 'css-loader'],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
new HtmlWebpackPlugin({
|
|
||||||
template: './public/index.html',
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
devServer: {
|
|
||||||
static: {
|
|
||||||
directory: path.join(__dirname, 'public'),
|
|
||||||
},
|
},
|
||||||
port: 3000,
|
module: {
|
||||||
open: true,
|
rules: [
|
||||||
},
|
{
|
||||||
|
test: /\.(js|jsx)$/,
|
||||||
|
exclude: /node_modules/,
|
||||||
|
use: ['babel-loader'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.scss$/,
|
||||||
|
use: ['style-loader', 'css-loader', 'sass-loader'],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.css$/,
|
||||||
|
use: ['style-loader', 'css-loader'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
new HtmlWebpackPlugin({
|
||||||
|
template: './public/index.html',
|
||||||
|
}),
|
||||||
|
new webpack.DefinePlugin({
|
||||||
|
'window.API_BASE_URL': JSON.stringify(
|
||||||
|
isProduction ? '/api/v1' : 'http://localhost:8080/api/v1'
|
||||||
|
),
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
devServer: {
|
||||||
|
static: {
|
||||||
|
directory: path.join(__dirname, 'public'),
|
||||||
|
},
|
||||||
|
port: 3000,
|
||||||
|
open: true,
|
||||||
|
},
|
||||||
|
};
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user