I am trying to setup a webpack configuration for the first time. I am getting the error "Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema" when i run the app. Here is the code in my webpack.config.js file.
const path = require("path");
const webpack = require("webpack");
const CopyWebpackPlugin = require("copy-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const IS_DEVELOPMENT = process.env.NODE_ENV === "dev";
const dirApp = path.join(__dirname, "app");
const dirImages = path.join(__dirname, "images");
const dirVideo = path.join(__dirname, "videos");
const dirStyles = path.join(__dirname, "styles");
const dirShared = path.join(__dirname, "shared");
const dirNode = "node_modules";
module.exports = {
entry: [path.join(dirApp, "index.js"), path.join(dirStyles, "index.scss")],
resolve: {
modules: [dirApp, dirShared, dirStyles, dirVideo, dirImages, dirNode],
},
plugins: [
new webpack.DefinePlugin({
IS_DEVELOPMENT,
}),
]
};
;
Here is the code in my webpack.config.development.js file
const path = require("path");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const { merge } = require("webpack-merge");
const config = require("./webpack.config");
module.exports = merge(config, {
node: "production",
output: {
path: path.join(__dirname, "public"),
},
plugins: [new CleanWebpackPlugin()],
});