I am trying to insert bundle.js dynamically without executing the EJS template but I get the below error. Is there a way to insert just the JS without executing the EJS template?
ERROR in Template execution failed: ReferenceError: description is not defined
ERROR in ReferenceError: description is not defined
I am actually rendering the template using node and I just want the bundle file to be dynamically inserted in the template.ejs
res.status(200).render('template',
{
description: description,
title:title
});
webpack config:
output: {
path: path.join(__dirname, 'dist'),
filename: "output.[hash].bundle.js",
publicPath: '/'
},
new HtmlWebpackPlugin({
inject: 'body',
template: 'views/template.ejs'
}),
template.ejs
<!DOCTYPE html>
<html lang="en" class="ddhub-site">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="format-detection" content="telephone=no">
<meta description=<%=description%>/>
<title> <%= title %> </title>
</head>
<body></body>
</html>
via Learner
No comments:
Post a Comment