有没有人遇到过 npm 包带来的不间断警告问题:@supabase/supabase-js
The warning message:
warn - ./node_modules/cross-fetch/node_modules/node-fetch/lib/index.js
Module not found: Can't resolve 'encoding' in '/Users/maxsilva/Sites/kamapay/sasa-frontend/node_modules/cross-fetch/node_modules/node-fetch/lib'
Import trace for requested module:
./node_modules/cross-fetch/node_modules/node-fetch/lib/index.js
./node_modules/cross-fetch/dist/node-ponyfill.js
./node_modules/@supabase/supabase-js/dist/main/lib/fetch.js
./node_modules/@supabase/supabase-js/dist/main/SupabaseClient.js
./node_modules/@supabase/supabase-js/dist/main/index.js
./lib/supabaseClient.js
./app/[lng]/page.jsx
Run Code Online (Sandbox Code Playgroud) 我正在使用 Supabase 和 Next.js 12.3.4 开发一个项目,并且我已经使用本教程设置了 Google 登录:Supabase Login with Google。当我运行项目时,终端反复警告
No storage option exists to persist the session, which may result in unexpected behavior when using auth.
If you want to set persistSession to true, please provide a storage option or you may set persistSession to false to disable this warning.
Run Code Online (Sandbox Code Playgroud)
这是登录代码:
import supabaseClient from "./supabaseClient";
export default async function signInWithGoogle() {
const { data, error } = await supabaseClient.auth.signInWithOAuth({
provider: 'google',
options: {
redirectTo: 'http://localhost:3000/account'
} …Run Code Online (Sandbox Code Playgroud) 我在我的 supabase 数据库中创建了一个名为的表customer。使用生成我的类型
npx supabase gen types typescript --project-id "$PROJECT_REF" --schema public > types/supabase.ts
Run Code Online (Sandbox Code Playgroud)
在我的 React 应用程序中,这就是我引用生成类型的方式。
const [customerDetails, setCustomerDetails] = useState<Database["public"]["Tables"]["customer"]["Row"]>()
Run Code Online (Sandbox Code Playgroud)
能不能再干净一点,像这样?
const [customerDetails, setCustomerDetails] = useState<customer>()
Run Code Online (Sandbox Code Playgroud)