Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

237
Views
Webpack dev-server Unexpected identifier error

I am new to React+Webpack. As a part of the tutorial, I have written a webpack.config.js file. This is the file content:

var webpack = require('webpack');
var path = require('path');

module.exports = {
    devtool: 'inline-source-map',
    entry: [
        'webpack-dev-server/client?http://localhost:8080/',
        'webpack/hot/only-dev-server',
        './src'
    ],
    output: {
        path: path.join(__dirname, 'public'),
        filename: 'bundle.js'
    },
    resolve:{
        moduleDirectories: ['node_modules', 'src'],
        extensions: ['', '.js']
    }
    module:{
        loaders:[
            {
                test: /\.jsx?$/,
                exclude: /node_modules/,
                loaders: ['react-hot','babel?presets[]=react,presets[]=es2015']
            }
        ]
    },
    plugins:[
        new webpack.HotModuleReplacementPlugin(),
        new webpack.NoErrorsPlugin()
    ]
};

I am getting Unexpected Identifier error at line number 19-> module:{...},

Error details:

/home/adi/testcode/webpack.config.js:19
    module:{
    ^^^^^^
SyntaxError: Unexpected identifier
    at Object.exports.runInThisContext (vm.js:78:16)
    at Module._compile (module.js:543:28)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at module.exports (/usr/lib/node_modules/webpack/bin/convert-argv.js:80:13)
    at Object.<anonymous> (/usr/lib/node_modules/webpack/bin/webpack.js:39:40)

I have checked webpack.config.js examples, and found what I wrote is correct. Yet it is not working as expected. Unfortunately, I couldn't find solution in GitHub issues, StackOverflow, and Quora.

Where am I making a mistake?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You forgot a comma before the module property

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!