AnomalyInnovations / serverless-bundle

Optimized packages for ES6 and TypeScript Node.js Lambda functions without any configuration.
https://serverless-stack.com/chapters/package-lambdas-with-serverless-bundle.html
MIT License
532 stars 153 forks source link

Warning on using handlebars with the plugin #93

Open MrSpark2591 opened 4 years ago

MrSpark2591 commented 4 years ago

Module Warning: require.extensions is not supported by webpack. Use a loader instead.

/node_modules/express-handlebars/lib/express-handlebars.js 12:17-38 /node_modules/express-handlebars/index.js

jayair commented 4 years ago

Can you provide more details? Is it just a warning? Is it failing to bundle?

MrSpark2591 commented 4 years ago

No, it's not failing the build.

Posting warnings that I get while webpack build happens.


WARNING in /Users/dhavalchaudhary/Desktop/bitbucket/serverless-crons/node_modules/handlebars/lib/index.js 22:38-56
Module Warning: require.extensions is not supported by webpack. Use a loader instead.
 @ /Users/dhavalchaudhary/Desktop/bitbucket/serverless-crons/node_modules/express-handlebars/lib/express-handlebars.js 12:17-38
 @ /Users/dhavalchaudhary/Desktop/bitbucket/serverless-crons/node_modules/express-handlebars/index.js
 @ /Users/dhavalchaudhary/Desktop/bitbucket/serverless-crons/node_modules/nodemailer-express-handlebars/lib/generator.js
 @ /Users/dhavalchaudhary/Desktop/bitbucket/serverless-crons/node_modules/nodemailer-express-handlebars/lib/index.js
 @ /Users/dhavalchaudhary/Desktop/bitbucket/serverless-crons/node_modules/nodemailer-express-handlebars/index.js
 @ /Users/dhavalchaudhary/Desktop/bitbucket/serverless-crons/workers/dailyReport/handler.js

WARNING in /Users/dhavalchaudhary/Desktop/bitbucket/serverless-crons/node_modules/handlebars/lib/index.js 23:2-20
Module Warning: require.extensions is not supported by webpack. Use a loader instead.
 @ /Users/dhavalchaudhary/Desktop/bitbucket/serverless-crons/node_modules/express-handlebars/lib/express-handlebars.js 12:17-38
 @ /Users/dhavalchaudhary/Desktop/bitbucket/serverless-crons/node_modules/express-handlebars/index.js
 @ /Users/dhavalchaudhary/Desktop/bitbucket/serverless-crons/node_modules/nodemailer-express-handlebars/lib/generator.js
 @ /Users/dhavalchaudhary/Desktop/bitbucket/serverless-crons/node_modules/nodemailer-express-handlebars/lib/index.js
 @ /Users/dhavalchaudhary/Desktop/bitbucket/serverless-crons/node_modules/nodemailer-express-handlebars/index.js
 @ /Users/dhavalchaudhary/Desktop/bitbucket/serverless-crons/workers/dailyReport/handler.js

WARNING in /Users/dhavalchaudhary/Desktop/bitbucket/serverless-crons/node_modules/handlebars/lib/index.js 24:2-20
Module Warning: require.extensions is not supported by webpack. Use a loader instead.
 @ /Users/dhavalchaudhary/Desktop/bitbucket/serverless-crons/node_modules/express-handlebars/lib/express-handlebars.js 12:17-38
 @ /Users/dhavalchaudhary/Desktop/bitbucket/serverless-crons/node_modules/express-handlebars/index.js
 @ /Users/dhavalchaudhary/Desktop/bitbucket/serverless-crons/node_modules/nodemailer-express-handlebars/lib/generator.js
 @ /Users/dhavalchaudhary/Desktop/bitbucket/serverless-crons/node_modules/nodemailer-express-handlebars/lib/index.js
 @ /Users/dhavalchaudhary/Desktop/bitbucket/serverless-crons/node_modules/nodemailer-express-handlebars/index.js
 @ /Users/dhavalchaudhary/Desktop/bitbucket/serverless-crons/workers/dailyReport/handler.js
jayair commented 4 years ago

Hmm it sounds like it doesn't support Webpack. Any ideas how to use handlebars with Webpack?

MrSpark2591 commented 4 years ago

https://handlebarsjs.com/installation/integrations.html

If you can guide me I can try giving a fix PR.

jayair commented 4 years ago

Yeah, I don't know handlebars too well but this loader seems to support importing files with the .handlebar extension.

https://github.com/pcardune/handlebars-loader

Have a look at this https://github.com/AnomalyInnovations/serverless-bundle/pull/90/files. It recently added support for importing .css and other files. Let me know if that makes sense.