From 25ea46aa8dcffb1606be5e81100bfa939081a0c6 Mon Sep 17 00:00:00 2001 From: Saoud Rizwan <7799382+saoudrizwan@users.noreply.github.com> Date: Sun, 23 Feb 2025 16:10:37 -0800 Subject: [PATCH] Revert "Add IS_DEV and Hot Reloading to debug. (#1895)" (#1917) This reverts commit b0446f7bac57b7bf299c8b59b85597b2eb46f38d. --- .changeset/yellow-paws-chew.md | 5 ----- .vscode/launch.json | 6 +----- .vscode/tasks.json | 5 ----- src/extension.ts | 17 ----------------- webview-ui/scripts/build-react-no-split.js | 10 ---------- .../src/components/settings/SettingsView.tsx | 2 +- 6 files changed, 2 insertions(+), 43 deletions(-) delete mode 100644 .changeset/yellow-paws-chew.md diff --git a/.changeset/yellow-paws-chew.md b/.changeset/yellow-paws-chew.md deleted file mode 100644 index b697783d76..0000000000 --- a/.changeset/yellow-paws-chew.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"claude-dev": minor ---- - -ADD IS_DEV and Hot Reloading to debug diff --git a/.vscode/launch.json b/.vscode/launch.json index c03c771a6d..90323404cc 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -11,11 +11,7 @@ "request": "launch", "args": ["--extensionDevelopmentPath=${workspaceFolder}"], "outFiles": ["${workspaceFolder}/dist/**/*.js"], - "preLaunchTask": "${defaultBuildTask}", - "env": { - "IS_DEV": "true", - "DEV_WORKSPACE_FOLDER": "${workspaceFolder}" - } + "preLaunchTask": "${defaultBuildTask}" } ] } diff --git a/.vscode/tasks.json b/.vscode/tasks.json index bb1e2b8999..e1413836d1 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -24,11 +24,6 @@ "presentation": { "group": "watch", "reveal": "never" - }, - "options": { - "env": { - "IS_DEV": "true" - } } }, { diff --git a/src/extension.ts b/src/extension.ts index 50e545472c..ed9cff31e9 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -7,7 +7,6 @@ import { Logger } from "./services/logging/Logger" import { createClineAPI } from "./exports" import "./utils/path" // necessary to have access to String.prototype.toPosix import { DIFF_VIEW_URI_SCHEME } from "./integrations/editor/DiffViewProvider" -import assert from "node:assert" /* Built using https://github.com/microsoft/vscode-webview-ui-toolkit @@ -191,19 +190,3 @@ export function activate(context: vscode.ExtensionContext) { export function deactivate() { Logger.log("Cline extension deactivated") } - -// TODO: remove this in production -// This is a workaround to reload the extension when the source code changes -// since vscode doesn't support hot reload for extensions -const { IS_DEV, DEV_WORKSPACE_FOLDER } = process.env - -if (IS_DEV) { - assert(DEV_WORKSPACE_FOLDER, "DEV_WORKSPACE_FOLDER must be set in development") - const watcher = vscode.workspace.createFileSystemWatcher(new vscode.RelativePattern(DEV_WORKSPACE_FOLDER, "src/**/*")) - - watcher.onDidChange(({ scheme, path }) => { - console.info(`${scheme} ${path} changed. Reloading VSCode...`) - - vscode.commands.executeCommand("workbench.action.reloadWindow") - }) -} diff --git a/webview-ui/scripts/build-react-no-split.js b/webview-ui/scripts/build-react-no-split.js index d393018c3c..28f37108be 100644 --- a/webview-ui/scripts/build-react-no-split.js +++ b/webview-ui/scripts/build-react-no-split.js @@ -12,7 +12,6 @@ const rewire = require("rewire") const defaults = rewire("react-scripts/scripts/build.js") const config = defaults.__get__("config") -const webpack = require("webpack") /* Modifying Webpack Configuration for 'shared' dir This section uses Rewire to modify Create React App's webpack configuration without ejecting. Rewire allows us to inject and alter the internal build scripts of CRA at runtime. This allows us to maintain a flexible project structure that keeps shared code outside the webview-ui/src directory, while still adhering to CRA's security model that typically restricts imports to within src/. @@ -120,15 +119,6 @@ config.output = { filename: "static/js/[name].js", } -// Adjust build environment variables for dev/debug builds. -config.plugins[4] = new webpack.DefinePlugin({ - "process.env": { - ...config.plugins[4].definitions["process.env"], - NODE_ENV: JSON.stringify(process.env.IS_DEV ? "development" : "production"), - IS_DEV: JSON.stringify(process.env.IS_DEV), - }, -}) - // Rename main.{hash}.css to main.css config.plugins[5].options.filename = "static/css/[name].css" config.plugins[5].options.moduleFilename = () => "static/css/main.css" diff --git a/webview-ui/src/components/settings/SettingsView.tsx b/webview-ui/src/components/settings/SettingsView.tsx index 994aab161f..ad1e141fa5 100644 --- a/webview-ui/src/components/settings/SettingsView.tsx +++ b/webview-ui/src/components/settings/SettingsView.tsx @@ -5,7 +5,7 @@ import { validateApiConfiguration, validateModelId } from "../../utils/validate" import { vscode } from "../../utils/vscode" import ApiOptions from "./ApiOptions" import SettingsButton from "../common/SettingsButton" -const { IS_DEV } = process.env +const IS_DEV = false // FIXME: use flags when packaging type SettingsViewProps = { onDone: () => void