0
votes

I'm using html-webpack-plugin to produce a html version of a ejs template. I'm using the ejs on staging and for Dev, but on production there needs to be a html file. In the EJS I have conditions to hide things on staging, but when I run webpack I get the following error:

   Module build failed: SyntaxError: Unexpected token if
- Function
- lodash.js:14843

ive tried to include ejs-loaders and such but still not working. Any suggestions? This is how my webpack script looks like:

    new HtmlWebpackPlugin({
      filename: 'app.html',
      template: 'views/app.ejs',
      inject: false,
      removeComments: true,
      collapseWhitespace: true
    })
1

1 Answers

0
votes

I fixed the issue, I had a incorrect path when using the ejs-loader

template: 'ejs-render-loader!./views/app.ejs',