html-webpack-plugin: Webpack 2.0.7-beta failing compile

Hi,

I’m having issues compiling with a very basic setup using Webpack 2. Getting two sets of errors ([…] = redacted):

ERROR in   Error: Child compilation failed:
  Module parse failed: [...]/node_modules/html-webpack-plugin/lib/loader.js!  [...]/node_modules/html-webpack-plugin/default_index.ejs Unexpected token   (1:0)
  You may need an appropriate loader to handle this file type.
  | <!DOCTYPE html>
  | <html>
  |   <head>:
  SyntaxError: Unexpected token (1:0)

  - compiler.js:78
    [...]/[html-webpack-plugin]/lib/compiler.js:78:16

  - Compiler.js:243 Compiler.<anonymous>
    [...]/[webpack]/lib/Compiler.js:243:10

  - Compiler.js:432
    [...]/[webpack]/lib/Compiler.js:432:12

...

and

Child html-webpack-plugin for "index.html":

    ERROR in ./~/html-webpack-plugin/lib/loader.js!./~/html-webpack-plugin/default_index.ejs
    Module parse failed: [...]/node_modules/html-webpack-plugin/lib/loader.js![...]/node_modules/html-webpack-plugin/default_index.ejs Unexpected token (1:0)
    You may need an appropriate loader to handle this file type.
    | <!DOCTYPE html>
    | <html>
    |   <head>

The config is

    context: __dirname + '/app',
    entry: { 'app' : './entry' },
    output: {
        path: __dirname + '/public/assets/[hash]',
        publicPath: "/assets/[hash]",
        filename: '[name].js'
    },
...
    devServer: {
        contentBase: "./public",
    }
...
    plugins: [
        new HtmlWebpackPlugin()
    ],

Any ideas?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 18 (12 by maintainers)

Commits related to this issue

Most upvoted comments

Have webpack 2.2.1 and this issue still exists, solution of RahavLussato not working