webpack not resolving esmodule imports without extension

18 views Asked by At

Why does webpack fail to resolve my esmodule imports. When I add extensions to import paths they get resolved. Shouldn't resolve option in webpack handle this? What can cause this? Thanks!

[webpack-cli] Failed to load '/Users/keijo/projects/Kaleva/lorien-zephr-components/webpack.config.js' config [webpack-cli] Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/Users/keijo/projects/Kaleva/lorien-zephr-components/webpack/prettierHtmlPlugin' imported from /Users/keijo/projects/Kaleva/lorien-zephr-components/webpack.config.js Did you mean to import ../webpack/prettierHtmlPlugin.js?

webpack.config.js

   export default (env, params) => ({
      mode: params.mode,
      devtool: 'source-map',
      resolve: {
        extensions: ['.js', '.json'],
      },

package.json

 "type": "module",
0

There are 0 answers