symfony / webpack-encore

A simple but powerful API for processing & compiling assets built around Webpack
https://symfony.com/doc/current/frontend.html
MIT License
2.23k stars 198 forks source link

Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. #1273

Closed kavithaAruna closed 3 months ago

kavithaAruna commented 3 months ago

In order to solve this issue I updated the webpack and webpack-cli from version 4 to version 5 image (79)

after updating when I tried to start my application again I'm getting this error image

and the versions of webpack is "webpack": "^5.93.0", "webpack-cli": "^5.1.4",

This is the config file

// webpack.config.js
const path = require("path");
const webpack = require("webpack");

const definePlugin = new webpack.DefinePlugin({
  CHUNK_FILENAME: JSON.stringify("/chunk.%chunkhash%.js"),
});

const env = {
  NODE_ENV: JSON.stringify("developement"),
  REACT_APP_URL: JSON.stringify(""),
};

module.exports = {
  entry: "./src/index.js", //root file that will be compiled
  output: { //A file name and folder that will be placed with compiled files
    path: path.resolve(__dirname, "dist"),
    filename: "[name].bundle.js",
  },
  plugins: [
    definePlugin,
    new webpack.DefinePlugin(env),
    new webpack.HotModuleReplacementPlugin(),
  ],
  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        use: {
          loader: "babel-loader",
          options: {
            presets: ["@babel/preset-env", "@babel/preset-react"],
          },
        },
      },
      {
        test: /\.(png|jpg|gif|svg|ico)$/,
        use: [
          {
            loader: "url-loader",
            options: {
              limit: 10000,
              name: "[name].[ext]",
            },
          },
        ],
      },
      {
        test: /\.css$/,
        use: ["css-loader"],
      },
    ],
  },
  optimization: {
    minimize: true,
    occurrenceOrder: true,
    splitChunks: {
      chunks: "all",
    },
  },
};
Kocal commented 3 months ago

Hi, I don't see the usage of Webpack Encore here, and so we can't really help you. I believe you will have more success on webpack/webpack-cli repositories, or better on stack overflow!

stof commented 3 months ago

I'm closing this issue as the webpack config is not created by webpack-encore in this report