docz icon indicating copy to clipboard operation
docz copied to clipboard

Can't import the named export 'Children' from non EcmaScript module

Open designbyadrian opened this issue 2 years ago • 2 comments

This is an issue with framer-motion running on certain setups including Create React App, NextJS, and Storybook.

The issue is more explained here: https://github.com/framer/motion/issues/1307, but I'd like to leave a report here because I think something needs to be adressed in this repo.

designbyadrian avatar Dec 17 '21 09:12 designbyadrian

In Create React App 5 it is no longer an Issue. If you have a project created with a previous version just try to update react-scripts, it solved the problem for me.

npm install [email protected]

Eric-Canas avatar Dec 21 '21 18:12 Eric-Canas

I was able to fix this by adding gatsby-node.js at the root of my project and the following rule on the webpack:

exports.onCreateWebpackConfig = ({ actions }) => {
  actions.setWebpackConfig({
    module: {
      rules: [
        {
          test: /\.mjs$/,
          include: /node_modules/,
          type: 'javascript/auto',
        },
      ],
    },
  })
}

prxg22 avatar Feb 08 '22 03:02 prxg22