From 5af319d31b0c464f1380297b7c8d0069b3fac3db Mon Sep 17 00:00:00 2001 From: Fernando Rojo Date: Tue, 19 Sep 2023 14:08:51 -0400 Subject: [PATCH 1/3] Update web.md --- docs/docs/web.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/docs/docs/web.md b/docs/docs/web.md index 5838fc4..eb0f7f9 100644 --- a/docs/docs/web.md +++ b/docs/docs/web.md @@ -18,6 +18,31 @@ Install `@expo/webpack-config` to your `devDependencies`: npm install -D @expo/webpack-config ``` +Add this in your `webpack.config.js` file: + +```js +const createExpoWebpackConfigAsync = require("@expo/webpack-config"); + +module.exports = async function (env, argv) { + const config = await createExpoWebpackConfigAsync( + { + ...env, + babel: { + dangerouslyAddModulePathsToTranspile: ["moti"], + }, + }, + argv + ); + config.module.rules.push({ + test: /\.mjs$/, + include: /node_modules/, + type: "javascript/auto", + }); + + return config; +}; +``` + Then run `yarn web` and you're done! ### Troubleshooting From ab569152a0a228e10f581c57386ac6a2a31ac9a7 Mon Sep 17 00:00:00 2001 From: Fernando Rojo Date: Tue, 19 Sep 2023 14:43:40 -0400 Subject: [PATCH 2/3] Update web.md --- docs/docs/web.md | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/docs/docs/web.md b/docs/docs/web.md index eb0f7f9..0e1a436 100644 --- a/docs/docs/web.md +++ b/docs/docs/web.md @@ -18,32 +18,23 @@ Install `@expo/webpack-config` to your `devDependencies`: npm install -D @expo/webpack-config ``` -Add this in your `webpack.config.js` file: +Then run `yarn web` and you're done! + +## Expo Router / Metro Web + +You'll need to add `mjs` to your `sourceExts` in `metro.config.js`. For example: ```js -const createExpoWebpackConfigAsync = require("@expo/webpack-config"); +const { getDefaultConfig } = require('expo/metro-config'); -module.exports = async function (env, argv) { - const config = await createExpoWebpackConfigAsync( - { - ...env, - babel: { - dangerouslyAddModulePathsToTranspile: ["moti"], - }, - }, - argv - ); - config.module.rules.push({ - test: /\.mjs$/, - include: /node_modules/, - type: "javascript/auto", - }); - - return config; -}; -``` +const config = getDefaultConfig(__dirname); -Then run `yarn web` and you're done! +config.resolver.assetExts.push( + 'mjs’ +); + +module.exports = config; +``` ### Troubleshooting From ecff9754de8333ed0519ec736423452610d13355 Mon Sep 17 00:00:00 2001 From: la55u <30611343+la55u@users.noreply.github.com> Date: Tue, 10 Oct 2023 15:05:45 +0200 Subject: [PATCH 3/3] docs: fix broken link and remove misleading reanimated v2 mention --- docs/docs/installation.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/docs/installation.md b/docs/docs/installation.md index 16a5a2b..39009a6 100644 --- a/docs/docs/installation.md +++ b/docs/docs/installation.md @@ -46,11 +46,11 @@ Moti `0.8.x` and higher requires at least Reanimated v2 stable (`2.0.0` or highe ### If you're using Expo -Please follow the [Expo instructions](https://docs.expo.io/versions/latest/sdk/reanimated) for installing `react-native-reanimated` v2. +Please follow the [Expo instructions](https://docs.expo.io/versions/latest/sdk/reanimated) for installing `react-native-reanimated`. ### If you aren't using Expo -Please follow Reanimated's [installation instructions](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/installation) for v2. +Please follow Reanimated's [installation instructions](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/getting-started/#installation). ## Import Reanimated