-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using Handlebars with webpack warning require.extentions not supported #953
Comments
I would recommend precompiling using something like handlebars-loader and utilizing the |
@kpdecker How would we do that? I've got handlebars 1.3.0 and handlebars-loader ^1.0.2 both installed, then I have an AMD module that looks like this: define([
'hbs!path/to/template' // path/to/template.hbs
],
function(template) {
// ...
}); and in webpack config I have: {
resolveLoader: {
fallback: path.join(__dirname, 'node_modules'),
alias: {
'hbs': 'handlebars-loader'
}
},
} so that the
What am I missing? What am I supposed to do with |
Alright, so adding an alias for handlebars seems to have gotten rid of the warnings: {
resolve: {
modulesDirectories: ['node_modules', 'src'],
fallback: path.join(__dirname, 'node_modules'),
alias: {
'handlebars': 'handlebars/runtime.js'
}
},
resolveLoader: {
fallback: path.join(__dirname, 'node_modules'),
alias: {
'hbs': 'handlebars-loader'
}
}
} That seems to be the trick, but I still have other errors to figure out before anything can even run, then I'll know if this works. |
The runtime does not include the compiler. You'll need to precompile your template, which is the best practice. If you absolutely need to compile templates on the client and are fine with the cost (startup and file size), then you'll want to alias handlebars to something like |
Thanks @kpdecker , |
I've also filed #1102 to see if this can be made cleaner for people who do want the whole runtime. |
For others looking here This is the best solution I have found Thanks to @mAAdhaTTah UPD:
|
Also does works. |
were you able to fix handlebars is not a function , i am getting this.viewEngine.renderView is not a function and i am using nextjs approuter |
Thanks @seyfer. This worked for me.
for next.config.ts
|
Is there any way to remove or disable these warnings when loading Handlebars with Webpack?
WARNING in ./~/handlebars/lib/index.js
require.extensions is not supported by webpack. Use a loader instead.
WARNING in ./~/handlebars/lib/index.js
require.extensions is not supported by webpack. Use a loader instead.
WARNING in ./~/handlebars/lib/index.js
require.extensions is not supported by webpack. Use a loader instead.
The text was updated successfully, but these errors were encountered: