sayar / ReactMVA

Project Repository for the React Microsoft Virtual Academy Course
Apache License 2.0
119 stars 173 forks source link

Two entries try to output same file. #7

Closed Raza403 closed 6 years ago

Raza403 commented 7 years ago

After executing "npm run start-webpack-server" the error comes out "ERROR in chunk html [entry] bundle.js Conflict: Multiple assets emit to the same filename bundle.js" I tried to solve this but my expertise are so little.

engmyahya commented 6 years ago

@Raza403 :: Fixed try do the following installation npm install react react-dom bootstrap react-bootstrap babel-preset-react --save npm install webpack css-loader style-loader file-loader url-loader babel-core babel-loader babel-preset-es2015 --save-dev npm install css-loader style-loader file-loader url-loader --save-dev npm install react react-dom --save-dev

I exactly used the following webpack.config.js code

var path = require('path');
var webpack = require('webpack');

module.exports = {
  context: path.join(__dirname, 'app'),
  entry: ['./index.html', './app.js'],
  output: { 
    path: path.join(__dirname, 'dist'),
    filename: 'bundle.js'
  },
  module: {
    loaders: [
      {
        test: /.js?$/,
        loader: 'babel-loader',
        exclude: /node_modules/,
        query: {
          presets: ['es2015', 'react']
        }
      },
      {
        test: /\.html$/,
        loader: "file-loader?name=[name].[ext]",
      },
      {
        test: /\.css$/, 
        loader: "style-loader!css-loader" 
      },
      { 
        test: /\.png$/, 
        loader: "url-loader?limit=100000" 
      },
      { 
        test: /\.jpg$/, 
        loader: "file-loader" 
      }
    ]
  },
  devServer: {
    historyApiFallback: true
  }
};