0

The "Uncaught ReferenceError: parseNumbers is not defined" error is throw at this point in the generated bundle:

    parseNumbers = function parseNumbers(str) {
    if (!isNaN(str)) {
        str = str % 1 === 0 ? parseInt(str, 10) : parseFloat(str);
    }
    return str;
};

I'm struggling with getting Hot Module Reloading to work, and this is the latest problem. Seems to me to be a Webpack problem, but who knows?

The bundle file builds ok without errors. Here is my webpack.config.js file:

var path = require('path');
var webpack = require('webpack');
var WebpackNotifierPlugin = require('webpack-notifier');

module.exports = {
context: path.join(__dirname, 'app'),
entry: [
    'webpack-dev-server/client?http://localhost:3000',
    'webpack/hot/only-dev-server',
    path.join(__dirname, 'app/app.js')
    //'app/app.js'
],
output: {
    path: path.join(__dirname, 'built'),
    filename: '[name].bundle.js'
    //filename: './built.bundle.js'
},
plugins: [
    new webpack.HotModuleReplacementPlugin(),
    new WebpackNotifierPlugin()
],
module: {
    loaders: [
        { test: /\.css$/, loader: "style!css" },
        { test: /\.jpe?g$|\.gif$|\.png$|\.svg$|\.woff$|\.ttf$|\.eot$/,     loader: "url" },
        {
            test: /\.js$/,
            loaders: ['react-hot', 'babel'],
            include: path.join(__dirname, 'app')
        }
    ]
}
};

What can I do to fix this? Thanks for any help.

MartinDuo
  • 663
  • 12
  • 25
  • If you didn't declare this variable using `let` or `var` above in this scope, or in any outer scope, it is a ReferenceError. You need to declare it to change, it's not possible to change what hasn't been declared as a variable. – rishat Sep 04 '16 at 21:51

1 Answers1

0

Yes. This was a stupid syntax error as pointed out by Muhametshin above. Adding the missing "var" fixed the problem. This mistake was compounded for me (as a long time user of Visual Studio's debugging) by my newbie status in debugging in Chrome and Webpack bundles.

MartinDuo
  • 663
  • 12
  • 25