-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.js
More file actions
executable file
·49 lines (44 loc) · 1.23 KB
/
Copy pathnext.config.js
File metadata and controls
executable file
·49 lines (44 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
compiler: {
removeConsole: process.env.NODE_ENV !== "development", // Remove console.log in production
},
eslint: {
ignoreDuringBuilds: true,
},
experimental: {
serverComponentsExternalPackages: ['@react-pdf/renderer'],
},
webpack: (config, { isServer }) => {
// Handle canvas for pdfjs-dist
config.resolve.alias.canvas = false;
// Fix pdfjs-dist worker resolution for client-side
if (!isServer) {
config.resolve.fallback = {
...config.resolve.fallback,
fs: false,
path: false,
};
// Add rule to handle PDF.js worker files
config.module.rules.push({
test: /pdf\.worker\.(min\.)?mjs$/,
type: 'asset/resource',
generator: {
filename: 'static/worker/[hash][ext][query]'
}
});
}
return config;
},
};
// Configuration object tells the next-pwa plugin
const withPWA = require("next-pwa")({
dest: "public",
disable: process.env.NODE_ENV === "development",
register: true,
skipWaiting: true,
});
// Export the combined configuration for Next.js with PWA support
module.exports = withPWA(nextConfig);