title: Module not found: Error: Can't resolve 'fs, net, path, util, os ...'
body: <p><strong>The following error occurs when bundling with webpack.</strong></p>
  <p>I set it up according to the method described in error, but I don't know what the problem is wrong with it.</p>
  <ul>
  <li>express / apollo-server / webpack5</li>
  </ul>
  <h1>Error</h1>
  <hr />
  <p>A total of 42 duplicated errors.</p>
  <pre><code>ERROR in ./node_modules/apollo-env/lib/utils/createHash.js 6:15-39
  Module not found: Error: Can't resolve 'crypto' in '/Users/pj/v2/server/node_modules/apollo-env/lib/utils'
  
  BREAKING CHANGE: webpack &lt; 5 used to include polyfills for node.js core modules by default.
  This is no longer the case. Verify if you need this module and configure a polyfill for it.
  
  If you want to include a polyfill, you need to:
          - add a fallback 'resolve.fallback: { &quot;crypto&quot;: require.resolve(&quot;crypto-browserify&quot;) }'
          - install 'crypto-browserify'
  If you don't want to include a polyfill, you can use an empty module like this:
          resolve.fallback: { &quot;crypto&quot;: false }
   @ ./node_modules/apollo-env/lib/utils/index.js 6:9-32
   @ ./node_modules/apollo-env/lib/index.js 8:9-27
   @ ./node_modules/@apollographql/apollo-tools/lib/index.js 6:0-21
   @ ./node_modules/apollo-server-core/dist/ApolloServer.js 41:23-61
   @ ./node_modules/apollo-server-core/dist/index.js 37:21-46
   @ ./node_modules/apollo-server-express/dist/index.js 13:27-56
   @ ./src/index.js 2:0-53 57:19-31
  
  ERROR in ./node_modules/apollo-server-core/dist/ApolloServer.js 28:14-28
  Module not found: Error: Can't resolve 'net' in '/Users/pj/v2/server/node_modules/apollo-server-core/dist'
   @ ./node_modules/apollo-server-core/dist/index.js 37:21-46
   @ ./node_modules/apollo-server-express/dist/index.js 13:27-56
   @ ./src/index.js 2:0-53 57:19-31
  
  ERROR in ./node_modules/apollo-server-core/dist/ApolloServer.js 29:14-28
  Module not found: Error: Can't resolve 'tls' in '/Users/pj/v2/server/node_modules/apollo-server-core/dist'
   @ ./node_modules/apollo-server-core/dist/index.js 37:21-46
   @ ./node_modules/apollo-server-express/dist/index.js 13:27-56
   @ ./src/index.js 2:0-53 57:19-31
  
  ERROR in ./node_modules/apollo-server-core/dist/plugin/schemaReporting/index.js 16:29-42
  Module not found: Error: Can't resolve 'os' in '/Users/pj/v2/server/node_modules/apollo-server-core/dist/plugin/schemaReporting'
  
  BREAKING CHANGE: webpack &lt; 5 used to include polyfills for node.js core modules by default.
  This is no longer the case. Verify if you need this module and configure a polyfill for it.
  
  If you want to include a polyfill, you need to:
          - add a fallback 'resolve.fallback: { &quot;os&quot;: require.resolve(&quot;os-browserify/browser&quot;) }'
          - install 'os-browserify'
  If you don't want to include a polyfill, you can use an empty module like this:
          resolve.fallback: { &quot;os&quot;: false }
   @ ./node_modules/apollo-server-core/dist/plugin/index.js 17:11-73
   @ ./node_modules/apollo-server-core/dist/index.js 49:13-32
   @ ./node_modules/apollo-server-express/dist/index.js 13:27-56
   @ ./src/index.js 2:0-53 57:19-31
  
  ERROR in ./node_modules/apollo-server-core/dist/plugin/usageReporting/plugin.js 17:15-30
  Module not found: Error: Can't resolve 'zlib' in '/Users/pj/v2/server/node_modules/apollo-server-core/dist/plugin/usageReporting'
  
  BREAKING CHANGE: webpack &lt; 5 used to include polyfills for node.js core modules by default.
  This is no longer the case. Verify if you need this module and configure a polyfill for it.
  
  If you want to include a polyfill, you need to:
          - add a fallback 'resolve.fallback: { &quot;zlib&quot;: require.resolve(&quot;browserify-zlib&quot;) }'
          - install 'browserify-zlib'
  If you don't want to include a polyfill, you can use an empty module like this:
          resolve.fallback: { &quot;zlib&quot;: false }
   @ ./node_modules/apollo-server-core/dist/plugin/usageReporting/index.js 3:15-34
   @ ./node_modules/apollo-server-core/dist/plugin/index.js 5:11-71 9:11-79 13:11-88
   @ ./node_modules/apollo-server-core/dist/index.js 49:13-32
   @ ./node_modules/apollo-server-express/dist/index.js 13:27-56
   @ ./src/index.js 2:0-53 57:19-31
  
  ERROR in ./node_modules/apollo-server-core/dist/utils/createSHA.js 9:15-39
  Module not found: Error: Can't resolve 'crypto' in '/Users/pj/v2/server/node_modules/apollo-server-core/dist/utils'
  
  BREAKING CHANGE: webpack &lt; 5 used to include polyfills for node.js core modules by default.
  This is no longer the case. Verify if you need this module and configure a polyfill for it.
  
  If you want to include a polyfill, you need to:
          - add a fallback 'resolve.fallback: { &quot;crypto&quot;: require.resolve(&quot;crypto-browserify&quot;) }'
          - install 'crypto-browserify'
  If you don't want to include a polyfill, you can use an empty module like this:
          resolve.fallback: { &quot;crypto&quot;: false }
   @ ./node_modules/apollo-server-core/dist/determineApolloConfig.js 7:36-64
   @ ./node_modules/apollo-server-core/dist/ApolloServer.js 46:32-66
   @ ./node_modules/apollo-server-core/dist/index.js 37:21-46
   @ ./node_modules/apollo-server-express/dist/index.js 13:27-56
   @ ./src/index.js 2:0-53 57:19-31
  
  ERROR in ./node_modules/busboy/lib/main.js 1:9-22
  Module not found: Error: Can't resolve 'fs' in '/Users/pj/v2/server/node_modules/busboy/lib'
   @ ./node_modules/graphql-upload/lib/processRequest.js 8:37-54
   @ ./node_modules/graphql-upload/lib/index.js 10:22-49
   @ ./node_modules/apollo-server-core/dist/index.js 47:6-45
   @ ./node_modules/apollo-server-express/dist/index.js 13:27-56
   @ ./src/index.js 2:0-53 57:19-31
  
  ERROR in ./node_modules/busboy/lib/types/multipart.js 8:21-47
  Module not found: Error: Can't resolve 'stream' in '/Users/pj/v2/server/node_modules/busboy/lib/types'
  
  BREAKING CHANGE: webpack &lt; 5 used to include polyfills for node.js core modules by default.
  This is no longer the case. Verify if you need this module and configure a polyfill for it.
  
  If you want to include a polyfill, you need to:
          - add a fallback 'resolve.fallback: { &quot;stream&quot;: require.resolve(&quot;stream-browserify&quot;) }'
          - install 'stream-browserify'
  If you don't want to include a polyfill, you can use an empty module like this:
          resolve.fallback: { &quot;stream&quot;: false }
   @ ./node_modules/busboy/lib/main.js 84:2-30
   @ ./node_modules/graphql-upload/lib/processRequest.js 8:37-54
   @ ./node_modules/graphql-upload/lib/index.js 10:22-49
   @ ./node_modules/apollo-server-core/dist/index.js 47:6-45
   @ ./node_modules/apollo-server-express/dist/index.js 13:27-56
   @ ./src/index.js 2:0-53 57:19-31
  
  ERROR in ./node_modules/content-disposition/index.js 22:15-39
  Module not found: Error: Can't resolve 'path' in '/Users/pj/v2/server/node_modules/content-disposition'
  
  BREAKING CHANGE: webpack &lt; 5 used to include polyfills for node.js core modules by default.
  This is no longer the case. Verify if you need this module and configure a polyfill for it.
  
  If you want to include a polyfill, you need to:
          - add a fallback 'resolve.fallback: { &quot;path&quot;: require.resolve(&quot;path-browserify&quot;) }'
          - install 'path-browserify'
  If you don't want to include a polyfill, you can use an empty module like this:
          resolve.fallback: { &quot;path&quot;: false }
   @ ./node_modules/express/lib/response.js 16:25-55
   @ ./node_modules/express/lib/express.js 22:10-31
   @ ./node_modules/express/index.js 11:0-41
   @ ./src/index.js 1:0-30 11:12-19 47:8-22 54:18-32
  
  ERROR in ./node_modules/cookie-signature/index.js 5:13-30
  Module not found: Error: Can't resolve 'crypto' in '/Users/pj/v2/server/node_modules/cookie-signature'
  
  BREAKING CHANGE: webpack &lt; 5 used to include polyfills for node.js core modules by default.
  This is no longer the case. Verify if you need this module and configure a polyfill for it.
  
  If you want to include a polyfill, you need to:
          - add a fallback 'resolve.fallback: { &quot;crypto&quot;: require.resolve(&quot;crypto-browserify&quot;) }'
          - install 'crypto-browserify'
  If you don't want to include a polyfill, you can use an empty module like this:
          resolve.fallback: { &quot;crypto&quot;: false }
   @ ./node_modules/express/lib/response.js 26:11-43
   @ ./node_modules/express/lib/express.js 22:10-31
   @ ./node_modules/express/index.js 11:0-41
   @ ./src/index.js 1:0-30 11:12-19 47:8-22 54:18-32
  
  ERROR in ./node_modules/destroy/index.js 14:17-41
  Module not found: Error: Can't resolve 'fs' in '/Users/pj/v2/server/node_modules/destroy'
   @ ./node_modules/send/index.js 18:14-32
   @ ./node_modules/express/lib/response.js 31:11-26
   @ ./node_modules/express/lib/express.js 22:10-31
   @ ./node_modules/express/index.js 11:0-41
   @ ./src/index.js 1:0-30 11:12-19 47:8-22 54:18-32
  
  ERROR in ./node_modules/destroy/index.js 15:13-30
  Module not found: Error: Can't resolve 'stream' in '/Users/pj/v2/server/node_modules/destroy'
  
  BREAKING CHANGE: webpack &lt; 5 used to include polyfills for node.js core modules by default.
  This is no longer the case. Verify if you need this module and configure a polyfill for it.
  
  If you want to include a polyfill, you need to:
          - add a fallback 'resolve.fallback: { &quot;stream&quot;: require.resolve(&quot;stream-browserify&quot;) }'
          - install 'stream-browserify'
  If you don't want to include a polyfill, you can use an empty module like this:
          resolve.fallback: { &quot;stream&quot;: false }
   @ ./node_modules/send/index.js 18:14-32
   @ ./node_modules/express/lib/response.js 31:11-26
   @ ./node_modules/express/lib/express.js 22:10-31
   @ ./node_modules/express/index.js 11:0-41
   @ ./src/index.js 1:0-30 11:12-19 47:8-22 54:18-32
  
  ERROR in ./node_modules/dicer/lib/Dicer.js 1:21-47
  Module not found: Error: Can't resolve 'stream' in '/Users/pj/v2/server/node_modules/dicer/lib'
  
  BREAKING CHANGE: webpack &lt; 5 used to include polyfills for node.js core modules by default.
  This is no longer the case. Verify if you need this module and configure a polyfill for it.
  
  If you want to include a polyfill, you need to:
          - add a fallback 'resolve.fallback: { &quot;stream&quot;: require.resolve(&quot;stream-browserify&quot;) }'
          - install 'stream-browserify'
  If you don't want to include a polyfill, you can use an empty module like this:
          resolve.fallback: { &quot;stream&quot;: false }
   @ ./node_modules/busboy/lib/types/multipart.js 11:12-28
   @ ./node_modules/busboy/lib/main.js 84:2-30
   @ ./node_modules/graphql-upload/lib/processRequest.js 8:37-54
   @ ./node_modules/graphql-upload/lib/index.js 10:22-49
   @ ./node_modules/apollo-server-core/dist/index.js 47:6-45
   @ ./node_modules/apollo-server-express/dist/index.js 13:27-56
   @ ./src/index.js 2:0-53 57:19-31
  
  ERROR in ./node_modules/dicer/lib/PartStream.js 2:21-47
  Module not found: Error: Can't resolve 'stream' in '/Users/pj/v2/server/node_modules/dicer/lib'
  
  BREAKING CHANGE: webpack &lt; 5 used to include polyfills for node.js core modules by default.
  This is no longer the case. Verify if you need this module and configure a polyfill for it.
  
  If you want to include a polyfill, you need to:
          - add a fallback 'resolve.fallback: { &quot;stream&quot;: require.resolve(&quot;stream-browserify&quot;) }'
          - install 'stream-browserify'
  If you don't want to include a polyfill, you can use an empty module like this:
          resolve.fallback: { &quot;stream&quot;: false }
   @ ./node_modules/dicer/lib/Dicer.js 6:17-40
   @ ./node_modules/busboy/lib/types/multipart.js 11:12-28
   @ ./node_modules/busboy/lib/main.js 84:2-30
   @ ./node_modules/graphql-upload/lib/processRequest.js 8:37-54
   @ ./node_modules/graphql-upload/lib/index.js 10:22-49
   @ ./node_modules/apollo-server-core/dist/index.js 47:6-45
   @ ./node_modules/apollo-server-express/dist/index.js 13:27-56
   @ ./src/index.js 2:0-53 57:19-31
  
  ERROR in ./node_modules/dotenv/lib/main.js 24:11-24
  Module not found: Error: Can't resolve 'fs' in '/Users/pj/v2/server/node_modules/dotenv/lib'
   @ ./src/index.js 4:0-28 15:0-13
  
  ERROR in ./node_modules/dotenv/lib/main.js 25:13-28
  Module not found: Error: Can't resolve 'path' in '/Users/pj/v2/server/node_modules/dotenv/lib'
  
  BREAKING CHANGE: webpack &lt; 5 used to include polyfills for node.js core modules by default.
  This is no longer the case. Verify if you need this module and configure a polyfill for it.
  
  If you want to include a polyfill, you need to:
          - add a fallback 'resolve.fallback: { &quot;path&quot;: require.resolve(&quot;path-browserify&quot;) }'
          - install 'path-browserify'
  If you don't want to include a polyfill, you can use an empty module like this:
          resolve.fallback: { &quot;path&quot;: false }
   @ ./src/index.js 4:0-28 15:0-13
  
  ERROR in ./node_modules/etag/index.js 21:13-30
  Module not found: Error: Can't resolve 'crypto' in '/Users/pj/v2/server/node_modules/etag'
  
  BREAKING CHANGE: webpack &lt; 5 used to include polyfills for node.js core modules by default.
  This is no longer the case. Verify if you need this module and configure a polyfill for it.
  
  If you want to include a polyfill, you need to:
          - add a fallback 'resolve.fallback: { &quot;crypto&quot;: require.resolve(&quot;crypto-browserify&quot;) }'
          - install 'crypto-browserify'
  If you don't want to include a polyfill, you can use an empty module like this:
          resolve.fallback: { &quot;crypto&quot;: false }
   @ ./node_modules/express/lib/utils.js 21:11-26
   @ ./node_modules/express/lib/application.js 24:18-48 25:25-62 26:19-50
   @ ./node_modules/express/lib/express.js 18:12-36
   @ ./node_modules/express/index.js 11:0-41
   @ ./src/index.js 1:0-30 11:12-19 47:8-22 54:18-32
  
  ERROR in ./node_modules/etag/index.js 22:12-31
  Module not found: Error: Can't resolve 'fs' in '/Users/pj/v2/server/node_modules/etag'
   @ ./node_modules/express/lib/utils.js 21:11-26
   @ ./node_modules/express/lib/application.js 24:18-48 25:25-62 26:19-50
   @ ./node_modules/express/lib/express.js 18:12-36
   @ ./node_modules/express/index.js 11:0-41
   @ ./src/index.js 1:0-30 11:12-19 47:8-22 54:18-32
  
  ERROR in ./node_modules/express/lib/application.js 23:11-26
  Module not found: Error: Can't resolve 'http' in '/Users/pj/v2/server/node_modules/express/lib'
  
  BREAKING CHANGE: webpack &lt; 5 used to include polyfills for node.js core modules by default.
  This is no longer the case. Verify if you need this module and configure a polyfill for it.
  
  If you want to include a polyfill, you need to:
          - add a fallback 'resolve.fallback: { &quot;http&quot;: require.resolve(&quot;stream-http&quot;) }'
          - install 'stream-http'
  If you don't want to include a polyfill, you can use an empty module like this:
          resolve.fallback: { &quot;http&quot;: false }
   @ ./node_modules/express/lib/express.js 18:12-36
   @ ./node_modules/express/index.js 11:0-41
   @ ./src/index.js 1:0-30 11:12-19 47:8-22 54:18-32
  
  ERROR in ./node_modules/express/lib/application.js 30:14-37
  Module not found: Error: Can't resolve 'path' in '/Users/pj/v2/server/node_modules/express/lib'
  
  BREAKING CHANGE: webpack &lt; 5 used to include polyfills for node.js core modules by default.
  This is no longer the case. Verify if you need this module and configure a polyfill for it.
  
  If you want to include a polyfill, you need to:
          - add a fallback 'resolve.fallback: { &quot;path&quot;: require.resolve(&quot;path-browserify&quot;) }'
          - install 'path-browserify'
  If you don't want to include a polyfill, you can use an empty module like this:
          resolve.fallback: { &quot;path&quot;: false }
   @ ./node_modules/express/lib/express.js 18:12-36
   @ ./node_modules/express/index.js 11:0-41
   @ ./src/index.js 1:0-30 11:12-19 47:8-22 54:18-32
  
  ERROR in ./node_modules/express/lib/request.js 18:11-30
  Module not found: Error: Can't resolve 'net' in '/Users/pj/v2/server/node_modules/express/lib'
   @ ./node_modules/express/lib/express.js 21:10-30
   @ ./node_modules/express/index.js 11:0-41
   @ ./src/index.js 1:0-30 11:12-19 47:8-22 54:18-32
  
  ERROR in ./node_modules/express/lib/request.js 20:11-26
  Module not found: Error: Can't resolve 'http' in '/Users/pj/v2/server/node_modules/express/lib'
  
  BREAKING CHANGE: webpack &lt; 5 used to include polyfills for node.js core modules by default.
  This is no longer the case. Verify if you need this module and configure a polyfill for it.
  
  If you want to include a polyfill, you need to:
          - add a fallback 'resolve.fallback: { &quot;http&quot;: require.resolve(&quot;stream-http&quot;) }'
          - install 'stream-http'
  If you don't want to include a polyfill, you can use an empty module like this:
          resolve.fallback: { &quot;http&quot;: false }
   @ ./node_modules/express/lib/express.js 21:10-30
   @ ./node_modules/express/index.js 11:0-41
   @ ./src/index.js 1:0-30 11:12-19 47:8-22 54:18-32
  
  ERROR in ./node_modules/express/lib/response.js 23:11-26
  Module not found: Error: Can't resolve 'path' in '/Users/pj/v2/server/node_modules/express/lib'
  
  BREAKING CHANGE: webpack &lt; 5 used to include polyfills for node.js core modules by default.
  This is no longer the case. Verify if you need this module and configure a polyfill for it.
  
  If you want to include a polyfill, you need to:
          - add a fallback 'resolve.fallback: { &quot;path&quot;: require.resolve(&quot;path-browserify&quot;) }'
          - install 'path-browserify'
  If you don't want to include a polyfill, you can use an empty module like this:
          resolve.fallback: { &quot;path&quot;: false }
   @ ./node_modules/express/lib/express.js 22:10-31
   @ ./node_modules/express/index.js 11:0-41
   @ ./src/index.js 1:0-30 11:12-19 47:8-22 54:18-32
  
  ERROR in ./node_modules/express/lib/view.js 17:11-26
  Module not found: Error: Can't resolve 'path' in '/Users/pj/v2/server/node_modules/express/lib'
  
  BREAKING CHANGE: webpack &lt; 5 used to include polyfills for node.js core modules by default.
  This is no longer the case. Verify if you need this module and configure a polyfill for it.
  
  If you want to include a polyfill, you need to:
          - add a fallback 'resolve.fallback: { &quot;path&quot;: require.resolve(&quot;path-browserify&quot;) }'
          - install 'path-browserify'
  If you don't want to include a polyfill, you can use an empty module like this:
          resolve.fallback: { &quot;path&quot;: false }
   @ ./node_modules/express/lib/application.js 22:11-28
   @ ./node_modules/express/lib/express.js 18:12-36
   @ ./node_modules/express/index.js 11:0-41
   @ ./src/index.js 1:0-30 11:12-19 47:8-22 54:18-32
  
  ERROR in ./node_modules/express/lib/view.js 18:9-22
  Module not found: Error: Can't resolve 'fs' in '/Users/pj/v2/server/node_modules/express/lib'
   @ ./node_modules/express/lib/application.js 22:11-28
   @ ./node_modules/express/lib/express.js 18:12-36
   @ ./node_modules/express/index.js 11:0-41
   @ ./src/index.js 1:0-30 11:12-19 47:8-22 54:18-32
  
  ERROR in ./node_modules/fs-capacitor/lib/index.js 6:37-54
  Module not found: Error: Can't resolve 'crypto' in '/Users/pj/v2/server/node_modules/fs-capacitor/lib'
  
  BREAKING CHANGE: webpack &lt; 5 used to include polyfills for node.js core modules by default.
  This is no longer the case. Verify if you need this module and configure a polyfill for it.
  
  If you want to include a polyfill, you need to:
          - add a fallback 'resolve.fallback: { &quot;crypto&quot;: require.resolve(&quot;crypto-browserify&quot;) }'
          - install 'crypto-browserify'
  If you don't want to include a polyfill, you can use an empty module like this:
          resolve.fallback: { &quot;crypto&quot;: false }
   @ ./node_modules/graphql-upload/lib/processRequest.js 10:19-42
   @ ./node_modules/graphql-upload/lib/index.js 10:22-49
   @ ./node_modules/apollo-server-core/dist/index.js 47:6-45
   @ ./node_modules/apollo-server-express/dist/index.js 13:27-56
   @ ./src/index.js 2:0-53 57:19-31
  
  ERROR in ./node_modules/fs-capacitor/lib/index.js 8:33-46
  Module not found: Error: Can't resolve 'fs' in '/Users/pj/v2/server/node_modules/fs-capacitor/lib'
   @ ./node_modules/graphql-upload/lib/processRequest.js 10:19-42
   @ ./node_modules/graphql-upload/lib/index.js 10:22-49
   @ ./node_modules/apollo-server-core/dist/index.js 47:6-45
   @ ./node_modules/apollo-server-express/dist/index.js 13:27-56
   @ ./src/index.js 2:0-53 57:19-31
  
  ERROR in ./node_modules/fs-capacitor/lib/index.js 10:33-46
  Module not found: Error: Can't resolve 'os' in '/Users/pj/v2/server/node_modules/fs-capacitor/lib'
  
  BREAKING CHANGE: webpack &lt; 5 used to include polyfills for node.js core modules by default.
  This is no longer the case. Verify if you need this module and configure a polyfill for it.
  
  If you want to include a polyfill, you need to:
          - add a fallback 'resolve.fallback: { &quot;os&quot;: require.resolve(&quot;os-browserify/browser&quot;) }'
          - install 'os-browserify'
  If you don't want to include a polyfill, you can use an empty module like this:
          resolve.fallback: { &quot;os&quot;: false }
   @ ./node_modules/graphql-upload/lib/processRequest.js 10:19-42
   @ ./node_modules/graphql-upload/lib/index.js 10:22-49
   @ ./node_modules/apollo-server-core/dist/index.js 47:6-45
   @ ./node_modules/apollo-server-express/dist/index.js 13:27-56
   @ ./src/index.js 2:0-53 57:19-31
  
  ERROR in ./node_modules/fs-capacitor/lib/index.js 12:35-50
  Module not found: Error: Can't resolve 'path' in '/Users/pj/v2/server/node_modules/fs-capacitor/lib'
  
  BREAKING CHANGE: webpack &lt; 5 used to include polyfills for node.js core modules by default.
  This is no longer the case. Verify if you need this module and configure a polyfill for it.
  
  If you want to include a polyfill, you need to:
          - add a fallback 'resolve.fallback: { &quot;path&quot;: require.resolve(&quot;path-browserify&quot;) }'
          - install 'path-browserify'
  If you don't want to include a polyfill, you can use an empty module like this:
          resolve.fallback: { &quot;path&quot;: false }
   @ ./node_modules/graphql-upload/lib/processRequest.js 10:19-42
   @ ./node_modules/graphql-upload/lib/index.js 10:22-49
   @ ./node_modules/apollo-server-core/dist/index.js 47:6-45
   @ ./node_modules/apollo-server-express/dist/index.js 13:27-56
   @ ./src/index.js 2:0-53 57:19-31
  
  ERROR in ./node_modules/mime/mime.js 2:9-22
  Module not found: Error: Can't resolve 'fs' in '/Users/pj/v2/server/node_modules/mime'
   @ ./node_modules/send/index.js 24:11-26
   @ ./node_modules/express/lib/response.js 31:11-26
   @ ./node_modules/express/lib/express.js 22:10-31
   @ ./node_modules/express/index.js 11:0-41
   @ ./src/index.js 1:0-30 11:12-19 47:8-22 54:18-32
  
  ERROR in ./node_modules/send/index.js 23:9-22
  Module not found: Error: Can't resolve 'fs' in '/Users/pj/v2/server/node_modules/send'
   @ ./node_modules/express/lib/response.js 31:11-26
   @ ./node_modules/express/lib/express.js 22:10-31
   @ ./node_modules/express/index.js 11:0-41
   @ ./src/index.js 1:0-30 11:12-19 47:8-22 54:18-32
  
  ERROR in ./node_modules/send/index.js 28:11-26
  Module not found: Error: Can't resolve 'path' in '/Users/pj/v2/server/node_modules/send'
  
  BREAKING CHANGE: webpack &lt; 5 used to include polyfills for node.js core modules by default.
  This is no longer the case. Verify if you need this module and configure a polyfill for it.
  
  If you want to include a polyfill, you need to:
          - add a fallback 'resolve.fallback: { &quot;path&quot;: require.resolve(&quot;path-browserify&quot;) }'
          - install 'path-browserify'
  If you don't want to include a polyfill, you can use an empty module like this:
          resolve.fallback: { &quot;path&quot;: false }
   @ ./node_modules/express/lib/response.js 31:11-26
   @ ./node_modules/express/lib/express.js 22:10-31
   @ ./node_modules/express/index.js 11:0-41
   @ ./src/index.js 1:0-30 11:12-19 47:8-22 54:18-32
  
  ERROR in ./node_modules/send/index.js 30:13-30
  Module not found: Error: Can't resolve 'stream' in '/Users/pj/v2/server/node_modules/send'
  
  BREAKING CHANGE: webpack &lt; 5 used to include polyfills for node.js core modules by default.
  This is no longer the case. Verify if you need this module and configure a polyfill for it.
  
  If you want to include a polyfill, you need to:
          - add a fallback 'resolve.fallback: { &quot;stream&quot;: require.resolve(&quot;stream-browserify&quot;) }'
          - install 'stream-browserify'
  If you don't want to include a polyfill, you can use an empty module like this:
          resolve.fallback: { &quot;stream&quot;: false }
   @ ./node_modules/express/lib/response.js 31:11-26
   @ ./node_modules/express/lib/express.js 22:10-31
   @ ./node_modules/express/index.js 11:0-41
   @ ./src/index.js 1:0-30 11:12-19 47:8-22 54:18-32
  
  ERROR in ./node_modules/serve-static/index.js 19:14-37
  Module not found: Error: Can't resolve 'path' in '/Users/pj/v2/server/node_modules/serve-static'
  
  BREAKING CHANGE: webpack &lt; 5 used to include polyfills for node.js core modules by default.
  This is no longer the case. Verify if you need this module and configure a polyfill for it.
  
  If you want to include a polyfill, you need to:
          - add a fallback 'resolve.fallback: { &quot;path&quot;: require.resolve(&quot;path-browserify&quot;) }'
          - install 'path-browserify'
  If you don't want to include a polyfill, you can use an empty module like this:
          resolve.fallback: { &quot;path&quot;: false }
   @ ./node_modules/express/lib/express.js 81:0-40
   @ ./node_modules/express/index.js 11:0-41
   @ ./src/index.js 1:0-30 11:12-19 47:8-22 54:18-32
  
  ERROR in ./src/index.js 40:17-37
  Module not found: Error: Can't resolve 'path' in '/Users/pj/v2/server/src'
  
  BREAKING CHANGE: webpack &lt; 5 used to include polyfills for node.js core modules by default.
  This is no longer the case. Verify if you need this module and configure a polyfill for it.
  
  If you want to include a polyfill, you need to:
          - add a fallback 'resolve.fallback: { &quot;path&quot;: require.resolve(&quot;path-browserify&quot;) }'
          - install 'path-browserify'
  If you don't want to include a polyfill, you can use an empty module like this:
          resolve.fallback: { &quot;path&quot;: false }
  </code></pre>
  <h1>webpack.config.js</h1>
  <hr />
  <p>Finished setting 'node{ooo:&quot;empty&quot;} and 'resolve fallback'.</p>
  <pre><code>const { CleanWebpackPlugin } = require(&quot;clean-webpack-plugin&quot;);
  const path = require(&quot;path&quot;);
  
  module.export = {
    entry: &quot;./src/index.js&quot;,
    mode: &quot;production&quot;,
    target: &quot;node&quot;,
    node: {
      fs: &quot;empty&quot;,
      net: &quot;empty&quot;,
      tls: &quot;empty&quot;,
    },
    resolve: {
      modules: [&quot;node_modules&quot;],
      extensions: [&quot;.js&quot;, &quot;.json&quot;],
      fallback: {
        path: require.resolve(&quot;path-browserify&quot;),
        util: require.resolve(&quot;util/&quot;),
        url: require.resolve(&quot;url/&quot;),
        buffer: require.resolve(&quot;buffer/&quot;),
        os: require.resolve(&quot;os-browserify/browser&quot;),
        stream: require.resolve(&quot;stream-browserify&quot;),
        crypto: require.resolve(&quot;crypto-browserify&quot;),
        http: require.resolve(&quot;stream-http&quot;),
        zlib: require.resolve(&quot;browserify-zlib&quot;),
      },
    },
    output: {
      publicPath: &quot;/&quot;,
      path: path.resolve(__dirname, &quot;build&quot;),
      filename: &quot;index.js&quot;,
    },
    module: {
      rules: [
        {
          test: /\.js$/,
          exclude: /node_modules/,
          use: {
            loader: &quot;babel-loader&quot;,
          },
        },
      ],
    },
    plugins: [new CleanWebpackPlugin()],
  };
  
  </code></pre>
  <h1>package.json</h1>
  <hr />
  <pre><code>{
    ...
  
    &quot;scripts&quot;: {
      &quot;dev:server&quot;: &quot;NODE_ENV=development nodemon --exec babel-node ./src/index.js&quot;,
      &quot;build&quot;: &quot;webpack --mode production --progress&quot;,
      &quot;start:server&quot;: &quot;NODE_ENV=production node ./build/index.js&quot;
    },
    &quot;keywords&quot;: [],
    &quot;author&quot;: &quot;&quot;,
    &quot;license&quot;: &quot;ISC&quot;,
    &quot;dependencies&quot;: {
      &quot;apollo-server&quot;: &quot;^2.19.2&quot;,
      &quot;apollo-server-express&quot;: &quot;^2.19.2&quot;,
      &quot;browserify-zlib&quot;: &quot;^0.2.0&quot;,
      &quot;buffer&quot;: &quot;^6.0.3&quot;,
      &quot;compression&quot;: &quot;^1.7.4&quot;,
      &quot;core-js&quot;: &quot;^3.8.1&quot;,
      &quot;cors&quot;: &quot;^2.8.5&quot;,
      &quot;crypto-browserify&quot;: &quot;^3.12.0&quot;,
      &quot;dotenv&quot;: &quot;^8.2.0&quot;,
      &quot;express&quot;: &quot;^4.17.1&quot;,
      &quot;graphql&quot;: &quot;^15.4.0&quot;,
      &quot;mongoose&quot;: &quot;^5.11.7&quot;,
      &quot;os-browserify&quot;: &quot;^0.3.0&quot;,
      &quot;path-browserify&quot;: &quot;^1.0.1&quot;,
      &quot;regenerator-runtime&quot;: &quot;^0.13.7&quot;,
      &quot;stream-browserify&quot;: &quot;^3.0.0&quot;,
      &quot;stream-http&quot;: &quot;^3.1.1&quot;,
      &quot;url&quot;: &quot;^0.11.0&quot;,
      &quot;util&quot;: &quot;^0.12.3&quot;,
      &quot;webpack&quot;: &quot;^5.16.0&quot;,
      &quot;webpack-cli&quot;: &quot;^4.4.0&quot;
    },
    &quot;devDependencies&quot;: {
      &quot;@babel/cli&quot;: &quot;^7.12.10&quot;,
      &quot;@babel/core&quot;: &quot;^7.12.10&quot;,
      &quot;@babel/node&quot;: &quot;^7.12.10&quot;,
      &quot;@babel/preset-env&quot;: &quot;^7.12.11&quot;,
      &quot;babel-loader&quot;: &quot;^8.2.2&quot;,
      &quot;clean-webpack-plugin&quot;: &quot;^3.0.0&quot;,
      &quot;nodemon&quot;: &quot;^2.0.6&quot;
    }
  }
  
  </code></pre>