lib/generators/frontrunner/templates/webpack.config.js in frontrunner-0.1.0 vs lib/generators/frontrunner/templates/webpack.config.js in frontrunner-0.1.1

- old
+ new

@@ -1,6 +1,7 @@ var path = require("path"); +var fs = require("fs"); var webpack = require("webpack"); var AssetsPlugin = require("assets-webpack-plugin"); var CompressionPlugin = require("compression-webpack-plugin"); var development = !process.env.RAILS_ENV || process.env.RAILS_ENV === "development"; @@ -16,12 +17,12 @@ }, module: { loaders: [ {test: /\.css$/, loader: "style-loader!css-loader"}, {test: /\.scss$/, loader: "style-loader!css-loader!sass-loader"}, - {test: /\.jsx?$|\.tag$/, exclude: /node_modules/, loader: "react-hot!babel-loader?cacheDirectory&presets[]=es2015&presets[]=react&plugins[]=react-require"}, - {test: /\.coffee$/, loader: "coffee-loader"}, + {test: /\.jsx?$/, loader: "babel-loader?cacheDirectory&presets[]=es2015&presets[]=react&plugins[]=react-require", exclude: /node_modules/}, + {test: /\.coffee$/, loader: "coffee-loader", exclude: /node_modules/}, {test: /\.woff2?$|\.ttf$|\.eot$|\.svg$/, loader: "file"} ] }, plugins: [ new webpack.DefinePlugin({ @@ -43,9 +44,13 @@ includePaths: [ path.join(__dirname, "node_modules") ] } }; + +if (fs.existsSync(path.join(__dirname, "node_modules", "react-hot-loader"))) { + config.module.loaders.unshift({test: /\.jsx?$/, loader: "react-hot", exclude: /node_modules/}); +} if (development) { config.devtool = "#eval-cheap-module-inline-source-map"; } else { config.plugins.push(