mailosaur / mailosaur-node

Mailosaur email and SMS testing library for Node.js

Home Page:https://mailosaur.com/docs/languages/nodejs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mailosaur webpack compilation error

mysticdevx opened this issue · comments

Platform: node v14.17.3 on MacOS v11.6, webpack: 5.60.0

I am working on a project with typescript. We are planning to use Mailosaur. I start implementing but I got a compilation error when I run the script. below is the error message I got:

Error: Webpack Compilation Error
Module not found: Error: Can't resolve 'net' in '/Users/xxxxxx/node_modules/https-proxy-agent/dist'

Module not found: Error: Can't resolve 'tls' in '/Users/xxxxxx/https-proxy-agent/dist'

Module not found: Error: Can't resolve 'https' in '/Users/xxxxxx/node_modules/mailosaur/lib'

Can anyone suggest a solution or a workaround?

Hi,
Can you provide some steps to reproduce this issue?
Thanks

Hi, thank you for the reply. It was a webpack polyfill problem and I have solved this by adding fallback for webpack.config.js as follows:

// fallback
      tls: false,
      net: false,
      https: false,
      http: false,
      buffer: require.resolve('buffer/')
//plugin for Buffer
    new webpack.ProvidePlugin({
      Buffer: ['buffer', 'Buffer'],
    }),