title: Module parse failed: Unexpected character
body: <p>After i used:</p>
  <pre><code>npm run build
  </code></pre>
  <p>i got this error:</p>
  <p><img src="https://i.stack.imgur.com/OXqKJ.png" alt="cmd error message" /></p>
  <p>My webpack.config.js:</p>
  <pre><code>const path = require('path');
  const HtmlWebpackPlugin = require('html-webpack-plugin')
  const CopyPlugin = require('copy-webpack-plugin');
  
  module.exports = {
    module: {
      rules: [
        { test: /\.js$/, exclude: /node_modules/, loader: &quot;babel-loader&quot; },
        {
          test: /\.css$/i,
          use: ['style-loader', 'css-loader'],
        },
        
      ]
    },
    entry: './app/game/index.js',
    output: {
      filename: 'main.js',
      path: __dirname + &quot;/src/main/resources/static&quot;
    },
    plugins: [
      new HtmlWebpackPlugin(),
      new CopyPlugin([
        { from: './app/assets', to: './assets' },
      ])
    ]
  };
  </code></pre>
  <p>My IdeaProjects\Flood\flood-project\app\game\index.js :</p>
  <pre><code>import MainMenu from './main-menu';
  import FloodSinglePlayer from './flood-single-player';
  import FloodMultiPlayer from './flood-multi-player';
  import canvas from './canvas.css';
  import body from './back.css';
  
  let wratio = window.innerWidth / window.innerHeight;
  let w = window.innerWidth;
  let h = window.innerHeight;
  let ratio = 4 / 3;
  if (wratio &lt; ratio) {
      w = Math.min(800, w) + &quot;px&quot;;
      h = (w / ratio) + &quot;px&quot;;
  } else {
      h = Math.min(600, h) + &quot;px&quot;;
      w = (h * ratio) + &quot;px&quot;;
  }
  
  var config = {
      type: Phaser.WEBGL,
      //width: canvas.width;
      //class: &quot;canvas&quot;,
      width: 800,
      height: 600,
      pixelArt: true,
      parent: 'phaser-example',
      scene: [ MainMenu, FloodMultiPlayer, FloodSinglePlayer ],
  };
  window.onload = () =&gt; {
      var can = document.querySelector(&quot;canvas&quot;);
      can.id = &quot;canvas&quot;;
  }
  //div.innerHTML = as;
  //document.getElementsByTagName(&quot;body&quot;)[0].appendChild(div);*/
  var game = new Phaser.Game(config);
  </code></pre>
  <p>My C:\Users\chote\IdeaProjects\Flood\flood-project\app\assets\games\background\back.css :</p>
  <pre><code>body { 
      background-image: url(../assets/games/background/background.png);
      background-position: left bottom; 
      background-repeat: repeat;
  }
  </code></pre>
  <p>My package.json :</p>
  <pre><code>    &quot;dependencies&quot;: {
      &quot;phaser&quot;: &quot;^3.18.1&quot;,
      &quot;style-loader&quot;: &quot;^1.0.0&quot;,
      &quot;webpack-merge&quot;: &quot;^4.2.1&quot;
    },
    &quot;devDependencies&quot;: {
      &quot;@babel/core&quot;: &quot;^7.5.4&quot;,
      &quot;@babel/preset-env&quot;: &quot;^7.5.4&quot;,
      &quot;babel-loader&quot;: &quot;^8.0.6&quot;,
      &quot;copy-webpack-plugin&quot;: &quot;^5.0.3&quot;,
      &quot;css-loader&quot;: &quot;^3.2.0&quot;,
      &quot;file-loader&quot;: &quot;^4.2.0&quot;,
      &quot;html-webpack-plugin&quot;: &quot;^3.2.0&quot;,
      &quot;image-webpack-loader&quot;: &quot;^5.0.0&quot;,
      &quot;webpack&quot;: &quot;^4.35.3&quot;,
      &quot;webpack-cli&quot;: &quot;^3.3.5&quot;,
      &quot;webpack-dev-server&quot;: &quot;^3.7.2&quot;
    }
  </code></pre>
  <p>How can i fix that error?
  Should i change webpack.config.js?
  I'm not think, that i declare wrong path.</p>