Skip to content

Commit adf06b0

Browse files
authored
Merge pull request marmelab#10663 from marmelab/doc-remix-debugging-setup-production
[Doc] Document how to setup Remix for production debugging
2 parents 8e73cbc + 874322e commit adf06b0

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

docs/Remix.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,3 +245,28 @@ export default function App() {
245245
That's it! Now Remix both renders the admin app and serves as a proxy to the Supabase API. You can test the app by visiting `http://localhost:5173/admin/`, and the API Proxy by visiting `http://localhost:5173/admin/api/posts`.
246246

247247
Note that the Supabase credentials never leave the server. It's up to you to add your own authentication to the API proxy.
248+
249+
## Sourcemaps in production
250+
251+
By default, Vite won't include the TypeScript sourcemaps in production builds. This means you'll only have the react-admin ESM builds for debugging.
252+
Should you prefer to have the TypeScript sources, you'll have to configure some Vite aliases:
253+
254+
```tsx
255+
// in vite.config.ts
256+
import { defineConfig } from "vite";
257+
import path from "path";
258+
import react from "@vitejs/plugin-react";
259+
260+
const alias = [
261+
{ find: 'react-admin', replacement: path.resolve(__dirname, './node_modules/react-admin/src') },
262+
{ find: 'ra-core', replacement: path.resolve(__dirname, './node_modules/ra-core/src') },
263+
{ find: 'ra-ui-materialui', replacement: path.resolve(__dirname, './node_modules/ra-ui-materialui/src') },
264+
// add any other react-admin packages you have
265+
]
266+
267+
export default defineConfig({
268+
plugins: [react()],
269+
build: { sourcemap: true },
270+
resolve: { alias },
271+
});
272+
```

0 commit comments

Comments
 (0)