Skip to content

Instantly share code, notes, and snippets.

@marklawlor
Created April 28, 2021 00:07
Show Gist options
  • Save marklawlor/9b9daf8a655d56fc98e3dc4e427c2f4e to your computer and use it in GitHub Desktop.
Save marklawlor/9b9daf8a655d56fc98e3dc4e427c2f4e to your computer and use it in GitHub Desktop.
Moti + Storybook + React-Native-Web
const path = require("path");
const { withUnimodules } = require("@expo/webpack-config/addons");
module.exports = {
stories: ["../src/**/*.stories.@(ts|tsx|js|jsx)"],
webpackFinal: async (config) => {
return withUnimodules(
config,
{
projectRoot: path.resolve(__dirname, "../"),
babel: { dangerouslyAddModulePathsToTranspile: ["moti"] },
},
{
expoConfig: {
web: {
build: {
babel: {
use: {
options: {
babelrc: false,
configFile: true,
},
},
},
},
},
},
}
);
},
};
@javidshirinbayli
Copy link

If you are getting a similar error to can't import the named export 'children' from nonecmascript module you need to add the lines below.
Some versions of frame-motion use the .mjs file inside.

config.module.rules.push({
      type: 'javascript/auto',
      test: /\.mjs$/,
      include: /node_modules/,
});

@AlissonEnz
Copy link

It worked amazingly, thanks for sharing it 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment