A
A
Artyom2020-10-03 22:02:19
JavaScript
Artyom, 2020-10-03 22:02:19

webpack not working, what to do?

const path = require("path");
const HTMLWebpackPlugin = require("html-webpack-plugin");

module.exports = {
  entry: "./src/index.js",
  output: {
    filename: "bundle.js",
    path: path.resolve(__dirname, "dist"),
  },
  devServer: {
    port: 3000,
  },
  plugins: [
    new HTMLWebpackPlugin({
      template: "./src/index.html",
    }),
  ],
};

Here is the minimum build, after I write webpack in the terminal, it gives
webpack
One CLI for webpack must be installed. These are recommended choices, delivered as separate packages:
- webpack-cli ( https://github.com/webpack/webpack-cli )
The original webpack full-featured CLI.
We will use "npm" to install the CLI via "npm install -D".
Do you want to install 'webpack-cli' (yes/no): n
You need to install 'webpack-cli' to use webpack via CLI.
You can also install the CLI manually.
here is the .json
{
  "name": "js",
  "version": "1.0.0",
  "description": "pure js site constructor",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [
    "js"
  ],
  "author":,
  "license": "ISC",
  "devDependencies": {
    "webpack": "^4.44.2",
    "webpack-cli": "^3.3.12",
    "webpack-dev-server": "^3.11.0"
  }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Q
quiplunar, 2020-10-03
@quiplunar

Remove node_modulesand reinstall all dependencies

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question