vahid-nejad / nextjs14-send-emails-with-dynamic-templates

27 stars 7 forks source link

handlebars bag #1

Open gayratv opened 7 months ago

gayratv commented 7 months ago

I'm clone project and run it under Windows 11, I see this error during compilation:

Compiling /page ...
 ⚠ ./node_modules/handlebars/lib/index.js
require.extensions is not supported by webpack. Use a loader instead.

Import trace for requested module:
./node_modules/handlebars/lib/index.js
./src/lib/compile-template.ts
./src/app/page.tsx

I was solved this problem this way: 1. add package: npm i -D handlebars-loader

  1. write this next.config.js:
    
    /** @type {import('next').NextConfig} */
    const path = require('path');

module.exports = { webpack: (config) => { config.module.rules.push({ test: /.hbs$/, loader: 'handlebars-loader', include: path.resolve(__dirname, 'src'), }); config.resolve.alias = { ...config.resolve.alias, handlebars: 'handlebars/dist/handlebars.min.js' }

    return config;
},

};



please, run your code - do you have this error?
maldee commented 3 months ago

please use react email instead this

https://react.email/docs/integrations/nodemailer