相关疑难解决方法(0)

使用 Nextjs-13 + Supabase 时无法解决“编码”模块错误

我正在尝试使用 Supabase 从我的表单插入/收集数据。但是当我编译时,出现编码模块未找到错误。我已经尝试过缓存清理和重新安装 npm 模块。他们也没有工作。

项目结构:

在此输入图像描述

apply/page.tsx 代码:

"use client"
import { supabase } from "lib/supabaseClient"

export default function Apply() {

    // This function called by button so we use "use client" at top.
    async function createApplyRecord() {
        const { error } = await supabase
            .from('applications')
            .insert({id: 1, fullname: "test", email: "aa", phone: "bb", githuburl: "cc", linkedinurl: "dd", about: "ee"})
            console.log("inserted")
            if(error) {
                console.log(error);
            }
    }

  return (SOME HTML CODE HERE)
}
Run Code Online (Sandbox Code Playgroud)

我得到的错误: 在此输入图像描述

npm typescript next.js supabase

32
推荐指数
3
解决办法
3万
查看次数

nextjs 中的 React-pdf 不允许进行构建

在创建文件并添加代码后,我在 nextjs 中使用react-pdf和react-pdf/renderer,它工作得很好,但是当我进行生产构建时,它会继续进行构建并且永远不会停止。这是代码

import React from 'react';
import { Page, Text, View, Document, StyleSheet } from '@react-pdf/renderer';


const PDFGenerator = () => {
    const styles = StyleSheet.create({
        page: {
            flexDirection: 'row',
            backgroundColor: '#E4E4E4'
        },
        section: {
            margin: 10,
            padding: 10,
            flexGrow: 1
        }
    });

    return (
        <Document>
            <Page size="A4" style={styles.page}>
                <View style={styles.section}>
                    <Text>Section #1</Text>
                </View>
                <View style={styles.section}>

                    <Text>Section #2</Text>
                </View>
            </Page>
        </Document>
        
      );
}
 
export default PDFGenerator;
Run Code Online (Sandbox Code Playgroud)

我在这里使用它

                 <PDFDownloadLink
                    document={<PDFGenerator/>}
                    fileName="recipe.pdf"
                    className="button-background w-full text-center text-color py-2 px-4 
                     rounded mt-10">
                    {({blob, …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs next.js react-pdf react-pdfrenderer

7
推荐指数
1
解决办法
3502
查看次数