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