I'm trying to update my project to webpack 2, and am getting the following error?
ERROR in Error: Child compilation failed:
Module parse failed: <PATH>web-frontend-wp2/node_modules/html-webpack-plugin/lib/loader.js!<PATH>/web-frontend-wp2/typescript/index.html Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
| <!DOCTYPE html>
| <!--[if lt IE 7 ]> <html lang="en" class="ie6" <% if(htmlWebpackPlugin.files.manifest) { %> manifest="<%= htmlWebpackPlugin.files.manifest %>"<% } %>> <![endif]-->
| <!--[if IE 7 ]> <html lang="en" class="ie7" <% if(htmlWebpackPlugin.files.manifest) { %> manifest="<%= htmlWebpackPlugin.files.manifest %>"<% } %>> <![endif]-->:
html-webpack-plugin@beta:
version "2.6.5"
webpack@beta:
version "2.2.0-rc.7"
Hm this looks familiar did you please check the FAQ?
Yes sorry, fixed by prepending the correct loader to my template option
How? According to faq and other docs, to use the default ejs loader, nothing is needed
mh, getting the same error with ejs-html-loader.
Error: Child compilation failed:
Module parse failed: C:\Users\Michael\...\ejs-html-loader\lib\index.js!C:\Users\Michael\...\index.ejs Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
| <!doctype html>
| <html lang="en">
| :
SyntaxError: Unexpected token (1:0)
- compiler.js:76
[backlog]/[html-webpack-plugin]/lib/compiler.js:76:16
Tried
template: 'path/to/index.ejs'
plus the loader config
{
test: /\.ejs$/,
loader: require.resolve('ejs-html-loader'),
},
and also tried
template: '!!ejs-html-loader!path/to/index.ejs'
In both cases the ejs-html-loader gets used and returns the compiled html but html-webpack-plugin fails in the compilation after that.
Surely I'm doing something wrong here (still new to how webpack works).
Apprecheate any pointers.
Without using the ejs-html-loader my configuration works just fine.
-- [email protected]
-- [email protected]
As @eddiemonge points out, nothing should be needed for the default loader.
In my case the error was caused by the template being located in the src dir.
Moving that out of src fixed the issue.
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.
Most helpful comment
How? According to faq and other docs, to use the default ejs loader, nothing is needed