mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-03-04 18:53:26 +08:00
build: fix development mode detection on windows (fehmer) (#4724)
* fix: development mode detection on windows * fix: development mode detection on windows
This commit is contained in:
parent
4aa75dccf0
commit
39eb13b4fa
4 changed files with 14 additions and 16 deletions
|
@ -8,7 +8,7 @@
|
|||
"dep-graph": "madge -c -i \"dep-graph.png\" ./src/ts",
|
||||
"build": "npx gulp build",
|
||||
"build-live": "export COMMIT_HASH=`git rev-parse --short HEAD` && npx gulp build-production",
|
||||
"dev": "concurrently \"NODE_ENV=development webpack serve --config=./webpack/config.dev.js\" \"npx gulp watch\"",
|
||||
"dev": "concurrently \"webpack serve --config=./webpack/config.dev.js\" \"npx gulp watch\"",
|
||||
"deploy-live": "npm run build-live && firebase deploy -P live --only hosting",
|
||||
"deploy-preview": "npm run build-live && firebase hosting:channel:deploy preview -P live --expires 2h",
|
||||
"tsc": "tsc",
|
||||
|
|
|
@ -3,8 +3,6 @@ const CopyPlugin = require("copy-webpack-plugin");
|
|||
const CircularDependencyPlugin = require("circular-dependency-plugin");
|
||||
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
||||
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
||||
const webpack = require("webpack");
|
||||
require("dotenv").config();
|
||||
|
||||
let circularImports = 0;
|
||||
|
||||
|
@ -21,15 +19,6 @@ const htmlWebpackPlugins = [
|
|||
});
|
||||
});
|
||||
|
||||
let BACKEND_URL = "https://api.monkeytype.com";
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
if (process.env.BACKEND_URL) {
|
||||
BACKEND_URL = process.env.BACKEND_URL;
|
||||
} else {
|
||||
BACKEND_URL = "http://localhost:5005";
|
||||
}
|
||||
}
|
||||
|
||||
/** @type { import('webpack').Configuration } */
|
||||
const BASE_CONFIG = {
|
||||
entry: {
|
||||
|
@ -88,10 +77,6 @@ const BASE_CONFIG = {
|
|||
},
|
||||
},
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
BACKEND_URL: JSON.stringify(BACKEND_URL),
|
||||
IS_DEVELOPMENT: JSON.stringify(process.env.NODE_ENV === "development"),
|
||||
}),
|
||||
new CircularDependencyPlugin({
|
||||
exclude: /node_modules/,
|
||||
include: /./,
|
||||
|
|
|
@ -2,6 +2,8 @@ const { resolve } = require("path");
|
|||
const { merge } = require("webpack-merge");
|
||||
const BASE_CONFIG = require("./config.base");
|
||||
const ExtraWatchWebpackPlugin = require("extra-watch-webpack-plugin");
|
||||
const webpack = require("webpack");
|
||||
require("dotenv").config();
|
||||
|
||||
/** @type { import('webpack').Configuration } */
|
||||
const DEV_CONFIG = {
|
||||
|
@ -21,6 +23,12 @@ const DEV_CONFIG = {
|
|||
new ExtraWatchWebpackPlugin({
|
||||
dirs: [resolve(__dirname, "../static/html")],
|
||||
}),
|
||||
new webpack.DefinePlugin({
|
||||
BACKEND_URL: JSON.stringify(
|
||||
process.env.BACKEND_URL || "http://localhost:5005"
|
||||
),
|
||||
IS_DEVELOPMENT: JSON.stringify(true),
|
||||
}),
|
||||
],
|
||||
};
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ const JsonMinimizerPlugin = require("json-minimizer-webpack-plugin");
|
|||
const WorkboxPlugin = require("workbox-webpack-plugin");
|
||||
|
||||
const BASE_CONFIG = require("./config.base");
|
||||
const webpack = require("webpack");
|
||||
|
||||
function pad(numbers, maxLength, fillString) {
|
||||
return numbers.map((number) =>
|
||||
|
@ -160,6 +161,10 @@ const PRODUCTION_CONFIG = {
|
|||
// },
|
||||
],
|
||||
}),
|
||||
new webpack.DefinePlugin({
|
||||
BACKEND_URL: JSON.stringify("https://api.monkeytype.com"),
|
||||
IS_DEVELOPMENT: JSON.stringify(false),
|
||||
}),
|
||||
],
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue