Attempted import error: ‘default’ is not exported from ‘../assertThisInitialized/_index.mjs’ – webpack incorrectly imports named imports as default

  babeljs, docker, react-redux, reactjs, webpack

For some strange reason, while running the production build in a docker container, webpack incorrectly attempts to import named imports as default. But running the production build directly on my Mac does not throw any errors. More strangely is the fact that everything worked just fine a couple of weeks ago.

Here’s a screenshot of the error I get when I run the build in the docker container:
named import error
import {connect} from 'react-redux' throws the error above.

But import connect from 'react-redux/es/connect/connect' does not throw any errors.

This is the case for many other libraries, such as ‘react-bootstrap’.
Does anyone have any ideas why webpack isn’t importing named imports correctly?

Source: Docker Questions