Skip to content

Commit

Permalink
docs(gotcha): Fix fs-extra re-export sample (remix-run#4125)
Browse files Browse the repository at this point in the history
  • Loading branch information
machour authored and freeman committed Sep 7, 2022
1 parent ea8b7d7 commit 3133ed6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/pages/gotchas.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ export default function SomeRoute() {
To fix it, move the import into a different module named `*.server.js` or `*.server.ts` and import from there. In our example here, we create a new file at `utils/fs-extra.server.js`:

```js filename=app/utils/fs-extra.server.js
export * from "fs-extra";
export { default } from "fs-extra";
```

And then change our import in the route to the new "wrapper" module:

```jsx filename=app/routes/index.jsx lines=[3]
import { json } from "@remix-run/node"; // or cloudflare/deno

import fs from "../utils/fs-extra.server";
import fs from "~/utils/fs-extra.server";

export async function loader() {
return json(await fs.pathExists("../some/path"));
Expand Down

0 comments on commit 3133ed6

Please sign in to comment.