good presidio
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { NextResponse, type NextRequest } from "next/server";
|
||||
import pdf from "pdf-parse";
|
||||
import pdf from "pdf-parse/lib/pdf-parse";
|
||||
import mammoth from "mammoth";
|
||||
|
||||
export async function POST(req: NextRequest) {
|
||||
|
||||
@@ -1,4 +1,44 @@
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {};
|
||||
// next.config.ts
|
||||
|
||||
module.exports = nextConfig;
|
||||
import { type NextConfig } from "next";
|
||||
import { type Configuration } from "webpack";
|
||||
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig: NextConfig = {
|
||||
// ... autres configurations
|
||||
|
||||
webpack: (config: Configuration, { isServer }: { isServer: boolean }) => {
|
||||
// ---- DÉBUT DE LA CORRECTION ----
|
||||
|
||||
// Récupère les externals existants, en initialisant un tableau vide si non défini.
|
||||
const existingExternals = config.externals || [];
|
||||
|
||||
// Remplace la configuration externals par un nouveau tableau.
|
||||
// Ce tableau contient :
|
||||
// 1. Les externals existants (s'ils étaient déjà un tableau, on les déverse, sinon on les met dans un tableau).
|
||||
// 2. Notre nouvel external pour 'fs'.
|
||||
config.externals = [
|
||||
...(Array.isArray(existingExternals)
|
||||
? existingExternals
|
||||
: [existingExternals]),
|
||||
{ fs: "fs" }, // On indique de ne pas bundler 'fs'
|
||||
];
|
||||
|
||||
// ---- FIN DE LA CORRECTION ----
|
||||
|
||||
// Côté client (navigateur), on ne veut pas du tout du module 'fs'.
|
||||
if (!isServer) {
|
||||
if (!config.resolve) {
|
||||
config.resolve = {};
|
||||
}
|
||||
config.resolve.fallback = {
|
||||
...config.resolve.fallback,
|
||||
fs: false,
|
||||
};
|
||||
}
|
||||
|
||||
return config;
|
||||
},
|
||||
};
|
||||
|
||||
export default nextConfig;
|
||||
|
||||
931
package-lock.json
generated
931
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -38,6 +38,7 @@
|
||||
"@types/pdfjs-dist": "^2.10.377",
|
||||
"@types/react": "^19",
|
||||
"@types/react-dom": "^19",
|
||||
"@types/webpack": "^5.28.5",
|
||||
"eslint": "^9",
|
||||
"eslint-config-next": "15.3.3",
|
||||
"tailwindcss": "^4",
|
||||
|
||||
31
types/pdf-parse.d.ts
vendored
Normal file
31
types/pdf-parse.d.ts
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
// types/pdf-parse.d.ts
|
||||
declare module "pdf-parse/lib/pdf-parse" {
|
||||
interface PDFInfo {
|
||||
PDFFormatVersion?: string;
|
||||
IsAcroFormPresent?: boolean;
|
||||
IsXFAPresent?: boolean;
|
||||
Title?: string;
|
||||
Author?: string;
|
||||
Subject?: string;
|
||||
Creator?: string;
|
||||
Producer?: string;
|
||||
CreationDate?: Date;
|
||||
ModDate?: Date;
|
||||
}
|
||||
|
||||
interface PDFMetadata {
|
||||
[key: string]: string | number | Date | undefined;
|
||||
}
|
||||
|
||||
interface PDFData {
|
||||
numpages: number;
|
||||
numrender: number;
|
||||
info: PDFInfo;
|
||||
metadata: PDFMetadata;
|
||||
version: string;
|
||||
text: string;
|
||||
}
|
||||
|
||||
function pdfParse(buffer: Buffer): Promise<PDFData>;
|
||||
export default pdfParse;
|
||||
}
|
||||
Reference in New Issue
Block a user