Skip to content

Commit

Permalink
emulate obias changes in commit #169
Browse files Browse the repository at this point in the history
  • Loading branch information
Falsal committed Jan 25, 2024
1 parent 5b0cebe commit 4b771f2
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 2 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"scripts": {
"generate-meta-tag": "node ./node_modules/react-cache-buster/dist/generate-meta-tag.js",
"start": "webpack serve --mode development --port 3000 --open --hot --progress --host localhost --static .",
"start-remote-api": "webpack serve --config webpack.config_uat.js --mode development --port 3000 --open --hot --progress --host localhost --static .",
"build": "npm run generate-meta-tag && npm run build-app",
"build-app": "webpack --config webpack.config_prod.js",
"test": "react-scripts test",
Expand Down
2 changes: 1 addition & 1 deletion src/axios.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var axios = require("axios");
export const baseURL =
// "https://www2.zuugle.at/api";
window.location.host.indexOf("localhost") >= 0
? "http://localhost:8080/api"
? process.env.REACT_APP_API_URL
: `${window.location.protocol}//${window.location.host}/api`;

let axiosInstance = axios.create({
Expand Down
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ module.exports = {
attributes: {},
}),
new webpack.DefinePlugin({
"process.env.API_URL": JSON.stringify("http://localhost:8080/api"),
"process.env.REACT_APP_API_URL": JSON.stringify("http://localhost:8080/api"),
}),
],
};
102 changes: 102 additions & 0 deletions webpack.config_uat.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
const webpack = require("webpack");
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const CopyWebpackPlugin = require("copy-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");

const BUILD_DIR = path.resolve(__dirname, "build");

module.exports = {
mode: "development",
output: {
path: BUILD_DIR,
filename: "./app_static/[name].bundle.js",
},

devServer: {
static: BUILD_DIR,
// directory: BUILD_DIR,
// staticOptions: {
// setHeaders: (res, path) => {
// if (path.endsWith('.json')) {
// res.setHeader('Content-Type', 'application/javascript');
// }
// },
// },
// staticOptions: {
// setHeaders: (res, path) => {
// if (path.endsWith('.json')) {
// res.setHeader('Content-Type', 'text/html');
// }
// },
// },

compress: true,
open: true,
historyApiFallback: true,
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: "babel-loader",
options: {
presets: [["@babel/preset-env", { targets: "defaults" }]],
},
},
},
{
test: /\.html$/,
loader: "html-loader",
},
{
test: /\.(scss)$/,
loader: "css-loader",
},
{
test: /\.css$/i,
use: [MiniCssExtractPlugin.loader, "css-loader"],
},
{
test: /\.svg$/i,
issuer: /\.[jt]sx?$/,
use: ["@svgr/webpack", "url-loader"],
},
{
test: /\.(png|jpg|jpeg|gif|ico)$/,
use: [
{
loader: "file-loader",
options: {
name: "./img/[name].[hash].[ext]",
},
},
],
},
{
test: /\.js$/,
enforce: "pre",
use: ["source-map-loader"],
},
],
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new HtmlWebpackPlugin({
inject: true,
template: "./public/index.html",
}),
new CopyWebpackPlugin({
patterns: [{ from: "./public", to: "app_static" }],
}),
new MiniCssExtractPlugin({
filename: "./app_static/[name].styles.css",
attributes: {},
}),
new webpack.DefinePlugin({
"process.env.REACT_APP_API_URL": JSON.stringify("https://www2.zuugle.at/api"),
}),
],
};

0 comments on commit 4b771f2

Please sign in to comment.