javascript - Webpack - Error: Cannot define 'query' and multiple loaders in loaders list -


the error appeared after added 'react-hot' loader in array. i've followed tutorials: https://robots.thoughtbot.com/setting-up-webpack-for-react-and-hot-module-replacement however, i'm getting error: cannot define 'query' , multiple loaders in loaders list.

var webpackdevserver = require("webpack-dev-server"); var webpack = require('webpack'); var path = require('path'); require("babel-polyfill");  var build_dir = path.resolve(__dirname, 'build'); var app_dir = path.resolve(__dirname, 'src');  module.exports = {   entry: [     'babel-polyfill',     'bootstrap-loader',     'webpack/hot/dev-server',     app_dir + '/import.js',   ],   output: {     path: build_dir,     filename: 'bundle.js'   },   module: {     loaders: [{       test: /\.jsx?$/,       loaders: ['react-hot', 'babel'],       exclude: /node_modules/,       query: {         plugins: ['transform-runtime'],         presets: ['es2015', 'stage-0', 'react']       }     }, {       test: /\.css$/,       loader: "style-loader!css-loader"     }, {       test: /\.scss$/,       loaders: ["style", "css", "sass"]     }, {       test: /\.(png|woff|woff2|eot|ttf|svg|jpg|gif)$/,       loader: 'url-loader?limit=100000'     }]   },   plugins: [     new webpack.provideplugin({       $: "jquery",       jquery: "jquery"     }),     new webpack.hotmodulereplacementplugin(),     new webpack.noerrorsplugin()   ] }; 

it seems query alternative way of customizing behaviour of single loader, cleaner specifying parameters inline (see below). if multiple loaders present, webpack not know query configuration applies.

the following should solve problem:

module: {     loaders: [{         test: /\.jsx?$/,         exclude: /node_modules/,         loaders: ['react-hot', 'babel?presets[]=es2015,presets[]=stage-0,presets[]=react,plugins[]=transform-runtime']     } 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -