Skip to content

Commit

Permalink
修正浏览器编译
Browse files Browse the repository at this point in the history
  • Loading branch information
2234839 committed Dec 9, 2023
1 parent aaaa30f commit 60ee7a2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion apps/frontend/src/components/web-custom/flow.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Test from "@/components/web-custom/Test_c.vue";
import { createApp } from "vue";
import { aElement, addAnchorELement, removeAnchorELement } from "./store";
import { addAnchorELement, removeAnchorELement } from "./store";

const div = document.createElement("div");
const app = createApp(Test);
Expand Down
7 changes: 2 additions & 5 deletions apps/frontend/src/util/store.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import { writeFileSync, readFileSync } from "fs";

// simple store by : node/browser

export function setItem(key: string, value: string) {
if (globalThis.localStorage) {
return localStorage.setItem(key, value);
} else {
return writeFileSync(`./store/${key}`, value, "utf-8");
return require("fs").writeFileSync(`./store/${key}`, value, "utf-8");
}
}

Expand All @@ -15,7 +12,7 @@ export function getItem(key: string): string | undefined {
return localStorage.getItem(key) ?? undefined;
} else {
try {
return readFileSync(`./store/${key}`, "utf-8");
return require("fs").readFileSync(`./store/${key}`, "utf-8");
} catch (_) {
return undefined;
}
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import vueJSX from "@vitejs/plugin-vue-jsx";
// https://vitejs.dev/config/

export default defineConfig({
plugins: [vue(), vueJSX()],
build: {
Expand Down

0 comments on commit 60ee7a2

Please sign in to comment.