Replies: 2 comments 3 replies
-
I think this is the kind of thing that happens when you have several layers of abstraction over a package, not saying it is inherently bad, but the problem seems to be that webpack is trying to compile the underlying handlebars code. This comment has a webpack object you could try to replicate The last link is the same but updated, I think you can just paste that int the next.js config webpack key. |
Beta Was this translation helpful? Give feedback.
2 replies
-
what about for turbopack? below wont' work turbopack: {
resolveAlias: {
handlebars: "handlebars/dist/handlebars.js",
},
}, |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
I use a library called
nodemailer-express-handlebars
to generate HTML templates, and all though everything seems to work just fine - the HTML templates is generated as expected - i get this warning in the terminal when I build, and when I call the api endpoint in dev mode:`Import trace for requested module:
./node_modules/handlebars/lib/index.js
./node_modules/express-handlebars/dist/express-handlebars.js
./node_modules/express-handlebars/dist/index.js
./node_modules/nodemailer-express-handlebars/lib/generator.js
./node_modules/nodemailer-express-handlebars/lib/index.js
./node_modules/nodemailer-express-handlebars/index.js
./app/api/contactForm/route.ts
./node_modules/handlebars/lib/index.js
require.extensions is not supported by webpack. Use a loader instead.`
This image shows how I import the package in my

app/api/contactForm/route.ts
file:This image shows my package.json:

I've tried to look for solutions, and found things like this:
However, I'm not sure this is possible and even the right way of doing it. I had to add the
express-handlebars
to make the this work at all, and everything seems to work just fine. The warning however is bugging me, and I would like to know if this is possible to solve. I tried to look into the docs but still can't figure out if I can or should try to configure an 'alias' somehow in thenext.config.js
.All input is highly appreciated.
Additional information
No response
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions