Skip to content

An unhandled exception occurred: Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. #1348

@Nagendra2109

Description

@Nagendra2109

Describe the Bug

After upgrading from Angular version 9 to Angular version 12 facing this webpack issue

Build is getting failed

  • Generating browser application bundles (phase: setup)...An unhandled exception occurred: Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
  • configuration.entry['main'] should not contain the item 'C:\DP-V12\dp-core-ui\node_modules\webpack-dev-server\client\index.js?http://0.0.0.0:0&sockPath=/sockjs-node' twice.
    -> All modules are loaded upon startup. The last one is exported.
    See "C:\Users\NAGEND~1.P\AppData\Local\Temp\ng-3ctuKX\angular-errors.log" for further details.
    npm ERR! code ELIFECYCLE
    npm ERR! syscall spawn
    npm ERR! file C:\WINDOWS\system32\cmd.exe
    npm ERR! errno ENOENT
    npm ERR! dp-core-ui-ng@0.0.0 start: node -max-old-space-size=2048 ./node_modules/@angular/cli/bin/ng serve --proxy-config proxy.config.json --port 4201
    npm ERR! spawn ENOENT
    npm ERR!
    npm ERR! Failed at the dp-core-ui-ng@0.0.0 start script.
    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:

Minimal Reproduction

extra-webpack.config.js

const singleSpaAngularWebpack = require('single-spa-angular/lib/webpack').default;

module.exports = (config, options) => {
const singleSpaWebpackConfig = singleSpaAngularWebpack(config, options);

// Feel free to modify this webpack config however you'd like to
singleSpaWebpackConfig.devServer.historyApiFallback = true;

return singleSpaWebpackConfig;
};

Expected Behavior

Build should be successfull

Screenshots

If applicable, add screenshots to help explain your problem.

Environment


Libs
- @angular/core version: "~12.2.0"
- "@angular-builders/custom-webpack": "12.1.3",
- "webpack": "^5.41.1",
- "single-spa": "^5.0.4",
- "single-spa-angular": "5.0.2",

For Tooling issues:
- Node version: 12.14.1
- Platform:  Windows 
Others:

Additional Context

Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions