K
K
KGZVER2020-08-07 11:43:03
JavaScript
KGZVER, 2020-08-07 11:43:03

Error about webpack build, how to solve the problem?

I started to learn webpack, but at the very beginning there was an error. Installed webpack and webpack-cli.
In the webpack.config.js file I wrote the following code

const path = require('path')

module.exports = {
  mode: 'development',
  entry: './src/index.js',
  output: {
    filename: 'bundle.js',
    path: path.resolve(__dirname, 'dist')
  }
}


Package.json has this code:
"name": "car-repair",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "webpack": "^4.44.1",
    "webpack-cli": "^3.3.12"
  }
}


In the created folder, dist was tied to index.html in the bundle.js scripts.

But when I write the code in index.js, for some reason nothing is displayed, although, according to the idea, it should be compiled into bundle.js

. What's the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey, 2020-08-07
@KGZVER

For starters - did you forget to run webpack?
in the console, in the directory with the project, the webpack or webpack --watch command if you want to track changes

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question