Skip to content

Commit 9737ae9

Browse files
committed
fix: node env
1 parent afb8897 commit 9737ae9

File tree

2 files changed

+16
-21
lines changed

2 files changed

+16
-21
lines changed

src/main.ts

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import "@/ui/styles/styles.scss";
22

3-
import { MarkdownView, Notice, Plugin } from "obsidian";
3+
import { MarkdownView, Plugin } from "obsidian";
44

55
import registerCustomIcons from "@/assets/icons";
66
import { EnhancedEditor } from "@/data/models/Settings";
@@ -21,21 +21,17 @@ export default class SlashCommanderPlugin extends Plugin {
2121
}
2222

2323
public async onload(): Promise<void> {
24-
try {
25-
// Initialize the Zustand state store
26-
useSettingStore.getState().setPlugin(this);
27-
await useSettingStore.getState().initialize();
24+
// Initialize the Zustand state store
25+
useSettingStore.getState().setPlugin(this);
26+
await useSettingStore.getState().initialize();
2827

29-
registerCustomIcons();
28+
registerCustomIcons();
3029

31-
// Register settings tab
32-
this.addSettingTab(new CommanderSettingTab(this));
30+
// Register settings tab
31+
this.addSettingTab(new CommanderSettingTab(this));
3332

34-
// Initialize plugin UI and commands
35-
this.initializePlugin();
36-
} catch (error) {
37-
new Notice(`SlashCommander: ${error}`);
38-
}
33+
// Initialize plugin UI and commands
34+
this.initializePlugin();
3935
}
4036

4137
private initializePlugin(): void {
@@ -70,14 +66,10 @@ export default class SlashCommanderPlugin extends Plugin {
7066
}
7167

7268
public onunload(): void {
73-
try {
74-
document.head.querySelector("style#cmdr")?.remove();
75-
this.menuSuggest?.close();
69+
document.head.querySelector("style#cmdr")?.remove();
70+
this.menuSuggest?.close();
7671

77-
// Clean up Zustand store subscription
78-
this.storeUnsubscribe?.();
79-
} catch (error) {
80-
new Notice(`SlashCommander: ${error}`);
81-
}
72+
// Clean up Zustand store subscription
73+
this.storeUnsubscribe?.();
8274
}
8375
}

vite.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ const external = [
4141

4242
export default defineConfig({
4343
plugins: [react(), tailwindcss()],
44+
define: {
45+
"process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV || "production"),
46+
},
4447
css: {
4548
// Fine-grained control over CSS
4649
preprocessorOptions: {

0 commit comments

Comments
 (0)