Html-webpack-plugin: nesting templates using ejs

Created on 26 Sep 2016  路  3Comments  路  Source: jantimon/html-webpack-plugin

Here is my code:

webpack.config.js
new htmlWebpackPlugin({ template: 'template.ejs' })

template.ejs
<html lang="en"> <% include head %> <body></body> </html>

This is the error I'm getting. Do I need to do something with lodash?

Html Webpack Plugin:
Error: Child compilation failed:
Module build failed: SyntaxError: Unexpected identifier

  • index.js:10809
    [banner-boiler]/[ejs-loader]/[lodash]/index.js:10809:16
  • index.js:11082
    [banner-boiler]/[ejs-loader]/[lodash]/index.js:11082:21
  • index.js:8152
    [banner-boiler]/[ejs-loader]/[lodash]/index.js:8152:31
  • index.js:10808 Function.template
    [banner-boiler]/[ejs-loader]/[lodash]/index.js:10808:

Most helpful comment

The fallback loader does not support include - please use a custom loader e.g.

new htmlWebpackPlugin({ template: '!!ejs-compiled-loader!template.ejs' })

https://github.com/bazilio91/ejs-compiled-loader

(don't know how well ejs-compiled-loader works but I hope you get the idea)

All 3 comments

The fallback loader does not support include - please use a custom loader e.g.

new htmlWebpackPlugin({ template: '!!ejs-compiled-loader!template.ejs' })

https://github.com/bazilio91/ejs-compiled-loader

(don't know how well ejs-compiled-loader works but I hope you get the idea)

works like a charm :) Thank you so much!

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings