Html-webpack-plugin: when html-webpack-plugin works with template-html-loader get error "htmlWebpackPlugin is not defined!"

Created on 10 May 2016  Â·  3Comments  Â·  Source: jantimon/html-webpack-plugin

I create a file index.ejs and write <%= htmlWebpackPlugin.options.title %> in line 90 of this file.

I write my loader like : { test: /\.ejs$/, loader: 'template-html-loader' },

but when I run command npm run webpack, I get an error: htmlWebpackPlugin is not defined in line 90 of index.ejs 。

Is html-webpack-plugin only works well with ejs-loader and handlebars-loader on current?

All 3 comments

Actually this should work

...
,{
        test: /\.ejs$/,
        use: 'ejs-loader?variable=data'
}
...

new webpack.ProvidePlugin({
      _: 'lodash'
}),
...

new htmlWebpackPlugin({
      inject: false,
      title: 'Chinastartup',
      filename: 'index.html',
      template: 'ejs-loader!index.ejs'
}),

version:

"webpack": "^2.2.1",
"html-webpack-plugin": "^2.28.0"

and my ejs-loader is work

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

Related issues

Rowno picture Rowno  Â·  3Comments

ghaiklor picture ghaiklor  Â·  3Comments

var-bp picture var-bp  Â·  3Comments

hp8wvvvgnj6asjm7 picture hp8wvvvgnj6asjm7  Â·  3Comments

lcxfs1991 picture lcxfs1991  Â·  4Comments