I am new to JS development, in an attempt to hot load changes using webpack-dev-server I keep above exception. The exact stack is:
Error: `output.path` needs
You could use __dirname to get current executed file's path.
const webpack = require('webpack')
module.exports = {
mode: 'development',
entry: __dirname + "/src/index.js",
output: {
path: __dirname + "/dist",
filename: 'main.js'
}
}
You could also import build-in path API & use resolve method, i think this one is prefer by webpack
const webpack = require('webpack')
const path = require('path')
module.exports = {
mode: 'development',
entry: path.resolve("./src/index.js"),
output: {
path: path.resolve("./dist"),
filename: 'main.js'
}
}