lalitmee
2/12/2018 - 12:47 PM

Web Pack configuration

Web Pack configuration

/* eslint strict: 0 */
("use strict");
var path = require("path");
var webpack = require("webpack");

module.exports = {
  entry: "./app/app.js",
  output: { path: __dirname + "/public" + "/js", filename: "bundle.js" },
  module: {
    rules: [
      {
        test: /\.js$/,
        loader: "babel-loader",
        exclude: /node_modules/,
        query: {
          presets: ["es2015", "react"]
        }
      },
      {
        test: /.jsx?$/,
        loader: "babel-loader",
        exclude: /node_modules/,
        query: {
          presets: ["es2015", "react"]
        }
      },
      {
        test: /\.css$/,
        use: [
          {
            loader: "style-loader"
          },
          {
            loader: "css-loader"
          }
        ],
        include: /node_modules/
      }
    ]
  }
};

```
Error Message
Hash: 396f0bfb9d565b6f60f0
Version: webpack 1.12.12
Time: 115ms
   [0] ./app/app.js 0 bytes [built] [failed]

ERROR in ./app/app.js
Module parse failed: /home/lalit/Desktop/Github/Electron/simple-electron/scotch-player/app/app.js Line 3: Unexpected token
You may need an appropriate loader to handle this file type.
| // ES6 Component
| // Import React and ReactDOM
| import React from "react";
| import ReactDOM from "react-dom";
| import { Header, Button, Container } from "semantic-ui-react";

```