Get 2024 Templates Mega Bundle!$1000 worth of 19 Bootstrap HTML, Vue & React Templates + 3 Vector Sets for just $99
Get for 99$

Invalid configuration object in Webpack


[webpack-cli] Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration[0].entry['js/widgets.bundle'] should be a non-empty array.
-> All modules are loaded upon startup. The last one is exported.
error Command failed with exit code 2.

I have found that the entries['js/widgets.bundle'] are returning an empty array instead of widgets paths.

// Widgets js
entries['js/widgets.bundle'] = glob.sync(entryPattern).map(file => file.replace(/\\/g, '/'));

System config:
Node Version: v21.5.0
Package Manager: Yarn


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (6)


I'm glad to hear that you were able to resolve the issue! Thank you for the update. We'll make sure to address this in the upcoming updates to improve compatibility with Windows machines. If you have any more questions or need further assistance, feel free to ask.



Thanks to all of you. I have solved the issue by replacing the "forward slash (/)" with "double backward slash (\\)" for Windows machines. Now it's working fine.



I had exactly the same issue, after replacing the code block, `npm run build` starts building but failed.

Threw this:


>> Failed to compile!

resolve "dropzone/dist/min/dropzone.min.js" in "D:\Metronic_demo1_HTML5\tools\webpack\plugins"
Parsed request is a module
using description file: D:\Metronic_demo1_HTML5\tools\package.json (relative path: ./webpack/plugins)
Field "browser" doesn"t contain a valid alias configuration
resolve as module
D:\Metronic_demo1_HTML5\tools\webpack\plugins\node_modules doesn"t exist or is not a directory
D:\Metronic_demo1_HTML5\tools\webpack\node_modules doesn"t exist or is not a directory
looking for modules in D:\Metronic_demo1_HTML5\tools\node_modules
existing directory D:\Metronic_demo1_HTML5\tools\node_modules\dropzone
using description file: D:\Metronic_demo1_HTML5\tools\node_modules\dropzone\package.json (relative path: .)
using description file: D:\Metronic_demo1_HTML5\tools\node_modules\dropzone\package.json (relative path: ./dist/min/dropzone.min.js)
no extension
Field "browser" doesn"t contain a valid alias configuration
D:\Metronic_demo1_HTML5\tools\node_modules\dropzone\dist\min\dropzone.min.js doesn"t exist
.js
Field "browser" doesn"t contain a valid alias configuration
D:\Metronic_demo1_HTML5\tools\node_modules\dropzone\dist\min\dropzone.min.js.js doesn"t exist



So I corrected the dropzone file in two files:

1. plugins.bundle.js
2. plugins.js

From
node_modules/dropzone/dist/min/dropzone.min.js

To:
node_modules/dropzone/dist/dropzone-min.js

Finally I got:

>> Building...
>> Completed in 14.591s!
webpack compiled successfully



Hi Amin,

Apologies for the delay. We're working on fixing the issue you reported. Could you please try making the following change?

const entryPattern = path.join(srcPath, "js/widgets/**/*.js");
// Widgets js
entries["js/widgets.bundle"] = (glob.sync(path.relative("./", srcPath).replaceAll(/\\/g, "/") + "/js/widgets/**/!(_)*.js") || []).map(file => {
return file.replaceAll(/\\/g, "/");
});


Please replace the existing code block with this updated snippet.

entries["js/widgets.bundle"] = (glob.sync(path.relative("./", srcPath).replaceAll(/\\/g, "/") + "/js/widgets/**/!(_)*.js") || []).map(file => {
return file.replaceAll(/\\/g, "/");
});


Let us know if this resolves the issue. Thank you for your patience.

Thanks



Hi Amin,

I apologize for the inconvenience. Could you please confirm whether you are using Windows? We will investigate and address the issue accordingly.

Thanks



I am on window 11


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(