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

489
Views
Require is not defined in Webpack %

I am new to Webpack. I Have made it by https://createapp.dev/... but when I had installed it then it is throwing many errors please help me...

This is Webpack config file please help me please..

const webpack = require("webpack")
const path = require('path');

const config = {
  entry: [
    'react-hot-loader/patch',
    './src/index.js'
  ],
  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: 'bundle.js'
  },
  module: {
    rules: [
      {
        test: /\.(js|jsx)$/,
        use: 'babel-loader',
        exclude: /node_modules/
      }
    ]
  },
  resolve: {
    extensions: [
      '.js',
      '.jsx'
    ],
    alias: {
      'react-dom': '@hot-loader/react-dom'
    }
  },
  devServer: {
    contentBase: './dist'
  },
  target:"node"
};

module.exports = config;

this is my package.json file

{
  "name": "firebase_crud",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "keywords": [],
  "author": "",
  "license": "ISC",
  "scripts": {
    "clean": "rm dist/bundle.js",
    "build-dev": "webpack --mode development",
    "build-prod": "webpack --mode production",
    "start": "webpack serve --hot --mode development"
  },
  "dependencies": {
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-hot-loader": "^4.13.0"
  },
  "devDependencies": {
    "webpack": "^5.50.0",
    "webpack-cli": "^4.8.0",
    "@babel/preset-react": "^7.14.5",
    "babel-loader": "^8.2.2",
    "@babel/core": "^7.15.0",
    "@babel/preset-env": "^7.15.0",
    "@hot-loader/react-dom": "^17.0.1+4.13.0",
    "webpack-dev-server": "^4.0.0",
    "eslint": "^7.32.0",
    "eslint-plugin-react": "^7.24.0"
  },
  "engines": {
    "node": "v14.17.3"
  }
}
and this is my terminal error.. Please help me .. I am new in Webpack. terminal eroor pic

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You need to remove contentBase from devServer section. On your screenshot you can find a list of possible options which are applicable for devServer section.

Configuration for devServer is here: https://webpack.js.org/configuration/dev-server/

BTW, Webpack4 had contentBase option https://v4.webpack.js.org/configuration/dev-server/#devservercontentbase

For the Webpack5 use https://webpack.js.org/configuration/dev-server/#directory

about 4 years ago · Juan Pablo Isaza 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!