Error while parsing JSON - npm run build


#1


https://www.codecademy.com/articles/react-setup-v


Hello
I experience an error message when attempting npm run build in React Setup, Part V: Conclusion. I have attempted to figure out the error for a while now with no luck. Perhaps I am missing something.
This is the error message:


This is a similar message as another poster, but the solution did not work for me.
This is the code in index.js, .babelrc and webpack.config.js:

If I need to show additional files, please let me know. Thanks in advance!

// Content in app/index.js
var React = require('react');
var ReactDOM = require('react-dom');
var App = require('./components/App');

ReactDOM.render(
    <App />,
    document.getElementById('app')
);

// Content in .babelrc
{ "presets": ["react"] }

// Content in webpack.config.js
var HTMLWebpackPlugin = require('html-webpack-plugin');
var HTMLWebpackPluginConfig = new HTMLWebpackPlugin({
    template:   __dirname + '/app/index.html',
    filename:   'index.html',
    inject:     'body'
});

module.exports = {
    entry: __dirname + '/app/index.js',
    module: {
        loaders: [
            {
                test: /\.js$/,
                exclude: /node_modules/,
                loader: 'babel-loader'
            }
        ]
    },
    output: {
        filename: 'transformed.js',
        path: __dirname + '/build'
    },
    plugins: [HTMLWebpackPluginConfig]
};


#2

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.