Code Monkey home page Code Monkey logo

react-hot-loader-minimal-boilerplate's Issues

Doesn't seem to work with jsx...

Modded webpack.config.js:

const webpack = require('webpack')
const path = require('path')

module.exports = {
  devtool: 'source-map',
  entry: {
    'app': [
      'babel-polyfill',
      'react-hot-loader/patch',
      './src/index'
    ]
  },
  output: {
    path: path.resolve(__dirname, './dist'),
    filename: '[name].js'
  },
  module: {
    rules: [
      { test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader' },
      {
        test: /\.jsx?$/,
        loader: 'babel',
        exclude: /node_modules/,
        query: {
          presets: ['react', 'es2015']
        }
      }
    ]
  }
}

Modded original Root.js and index.js to .jsx files. Got an error message:

ERROR in multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server babel-polyfill react-hot-loader/patch ./src/index
Module not found: Error: Can't resolve './src/index' in '/Users/aero/Documents/Work/react-hot-loader-minimal-boilerplate'
 @ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server babel-polyfill react-hot-loader/patch ./src/index

Webpack complains about loader:['react-hot-loader/webpack','babel-loader'],

webpack doesn't seems to allow adding loader:['react-hot-loader/webpack','babel-loader'],
app:devServer Enabling webpack dev middleware. +0ms
/home/ekam/devel/payloadApp/node_modules/webpack/lib/RuleSet.js:174
throw new Error(RuleSet.buildErrorMessage(rule, new Error("options/query cannot be used with loaders (use options for each array item)")));
^

Error: options/query cannot be used with loaders (use options for each array item) in {
"test": {},
"exclude": {},
"loader": [
"react-hot-loader/webpack",
"babel-loader"
],
"query": {
"presets": [
"react",
"es2015",
"stage-2"
]
}
}

var webpack = require('webpack');
var HTMLWebpackPlugin = require('html-webpack-plugin')
var HTMLWebpackPluginConfig = new HTMLWebpackPlugin({
			template: __dirname + '/app/index.html',
			filename: 'index.html',
			inject: 'body'
		});
var CopyWebpackPlugin = require('copy-webpack-plugin')
var CopyWebpackPluginConfig = new CopyWebpackPlugin([{ from: 'static'}])

const path = require('path');

module.exports = {

	entry: ['react-hot-loader/patch',
			'webpack-dev-server/client?http://0.0.0.0:8080',
			'webpack/hot/only-dev-server', //<- doesn’t reload the browser upon syntax errors. This is recommended for React apps because it keeps the state
			//'webpack/hot/dev-server', //<- To perform HMR in the browser reloads if HMR update fails.
			__dirname + '/app/index.js'],

	context: __dirname,
	module:{
		loaders:[
			{
				test:/\.js$/,
				exclude: /node_modules/,
				loader:['react-hot-loader/webpack','babel-loader'],
				query:{
					presets:["react","es2015","stage-2",]
				}
				
			},
			{
				test: /\.css$/,
				exclude: /node_modules/,
				loader: 'style!css'
			}
		]
	},
	output:{
		filename:'payload-min.js',
		path: __dirname + '/build',
		publicPath: __dirname + '/build'
	},
	plugins:[CopyWebpackPluginConfig , 
			 HTMLWebpackPluginConfig ,
			 new webpack.HotModuleReplacementPlugin(),
    		 new webpack.NoEmitOnErrorsPlugin()]

};

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.