构建环境中出现故事书错误的成帧器运动

kor*_*aby 2 storybook framer-motion

我正在构建一个 UI 库。

有人将framer-motion 与故事书一起使用吗?

它在故事书中工作正常,但在构建环境中出现错误。

有些人建议降级,但这对我不起作用。

有人有和我类似的问题吗?

Mic*_*ijn 7

在这里遇到同样的问题。我认为这是由于新版本的 Framer-motion 与某些工具不兼容所致。我今天将进行调试,并让您知道我是否能够找到解决方案。

编辑

成功了!将以下内容添加到您的 .storybook/main.js 文件中

module.exports = {
  // Any existing rules
  ...

  // The fix
  webpackFinal: async (config) => {
    config.module.rules.push({
      test: /\.mjs$/,
      include: /node_modules/,
      type: "javascript/auto",
    });
    return config;
  }
}
Run Code Online (Sandbox Code Playgroud)