I'm in the process of creating a webpack application and I am keen on utilizing ESM (ECMAScript Modules) throughout the entire project. This involves configuring the webpack.config file to allow for ESM imports.
Previously, I knew that this could be achieved using Babel. However, npm has now added support for ESM imports without the need for Babel by introducing the
"type": "module"
directive. I have successfully tested this with Express, but when attempting to do the same with Webpack, I encountered the following error:
> ...proyectDirectory/node_modules/webpack-cli/bin/cli.js:93
> require() of ES modules is not supported.
This led me to wonder if there is a version of webpack-cli available that utilizes import
statements instead of require
calls.