File size: 1,002 Bytes
872630d
eed54e3
872630d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
module.exports = {
    output: "standalone",
    webpack: (config, { isServer }) => {
      if (!isServer) {
        // Web Worker configuration
        config.module.rules.push({
          test: /\.worker\.js$/,
          loader: 'worker-loader',
          options: {
            publicPath: '/_next/static/worker/',
            filename: 'static/worker/[hash].worker.js',
          },
        });
  
        // Configuration for .node files
        config.module.rules.push({
          test: /\.node$/,
          loader: 'node-loader',
        });
  
        // Resolve aliases to prevent bundling certain server-side modules in client-side code
        config.resolve.alias = {
          ...config.resolve.alias,
          // Mock sharp module
          "sharp$": false,
          // Mock onnxruntime-node module
          "onnxruntime-node$": false,
        };
      }

      config.resolve.alias.canvas = false
      config.resolve.alias.encoding = false
      
      return config;
    },
  };