config
parent
00ac176862
commit
c4740f9b0d
10
config.js
10
config.js
|
@ -4,4 +4,12 @@ const dev = {
|
|||
REVERSE_PROXY_DOCS_URL: "https://toodle.ddns.net/docs/books/reverse-proxy"
|
||||
};
|
||||
|
||||
module.exports = { dev };
|
||||
const prod = {
|
||||
NODE_ENV: "production",
|
||||
PUBLIC_URL: "/reverse-proxy",
|
||||
REVERSE_PROXY_API_URL: "https://toodle.ddns.net/reverse-proxy-api",
|
||||
CHATBOT_API_URL: "https://toodle.ddns.net/chatbot-api",
|
||||
REVERSE_PROXY_DOCS_URL: "https://toodle.ddns.net/docs/books/reverse-proxy"
|
||||
};
|
||||
|
||||
module.exports = { dev, prod };
|
||||
|
|
|
@ -4,9 +4,15 @@ const HtmlWebpackPlugin = require("html-webpack-plugin");
|
|||
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
||||
const webpackBundleAnalyzer = require("webpack-bundle-analyzer");
|
||||
const CopyPlugin = require("copy-webpack-plugin");
|
||||
const config = require("./config");
|
||||
|
||||
process.env.NODE_ENV = "production";
|
||||
process.env.PUBLIC_URL = "/reverse-proxy";
|
||||
process.env.NODE_ENV = config.prod.NODE_ENV;
|
||||
process.env.PUBLIC_URL = config.prod.PUBLIC_URL;
|
||||
|
||||
let configs = {};
|
||||
Object.keys(config.dev).forEach(z => {
|
||||
configs[`process.env.${z}`] = JSON.stringify(config.dev[z]);
|
||||
});
|
||||
|
||||
module.exports = {
|
||||
mode: "production",
|
||||
|
@ -26,17 +32,7 @@ module.exports = {
|
|||
filename: "[name].[contenthash].css"
|
||||
}),
|
||||
|
||||
new webpack.DefinePlugin({
|
||||
// This global makes sure React is built in prod mode.
|
||||
"process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV),
|
||||
"process.env.PUBLIC_URL": JSON.stringify(process.env.PUBLIC_URL),
|
||||
"process.env.REVERSE_PROXY_API_URL": JSON.stringify(
|
||||
"https://toodle.ddns.net/reverse-proxy-api"
|
||||
),
|
||||
"process.env.CHATBOT_API_URL": JSON.stringify(
|
||||
"https://toodle.ddns.net/chatbot-api"
|
||||
)
|
||||
}),
|
||||
new webpack.DefinePlugin(configs),
|
||||
new HtmlWebpackPlugin({
|
||||
template: "src/index.html",
|
||||
favicon: "src/favicon.ico",
|
||||
|
|
Loading…
Reference in New Issue