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",
}),
],
};
Вот минимальная сборка, после того как пишу в терминале webpack, то выдает
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.
вот .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"
}
}