From 2033711995d8ee76fc78065dcc36d0944555c7b6 Mon Sep 17 00:00:00 2001 From: Jan Potoms <2109932+Janpot@users.noreply.github.com> Date: Wed, 10 May 2023 13:06:07 +0200 Subject: [PATCH] Fix broken preview in vite runtime (#1989) --- packages/toolpad-app/src/server/toolpadAppBuilder.ts | 9 +++++++++ packages/toolpad-app/tsup.config.ts | 1 + 2 files changed, 10 insertions(+) diff --git a/packages/toolpad-app/src/server/toolpadAppBuilder.ts b/packages/toolpad-app/src/server/toolpadAppBuilder.ts index 06facf16ac0..2c021dc3226 100644 --- a/packages/toolpad-app/src/server/toolpadAppBuilder.ts +++ b/packages/toolpad-app/src/server/toolpadAppBuilder.ts @@ -220,6 +220,15 @@ export function createViteConfig({ }, }, }, + resolve: { + alias: [ + { + // FIXME(https://github.com/mui/material-ui/issues/35233) + find: /^@mui\/icons-material\/([^/]*)/, + replacement: '@mui/icons-material/esm/$1', + }, + ], + }, server: { fs: { allow: [root, path.resolve(__dirname, '../../../../')], diff --git a/packages/toolpad-app/tsup.config.ts b/packages/toolpad-app/tsup.config.ts index 47a23de664c..d13378285cc 100644 --- a/packages/toolpad-app/tsup.config.ts +++ b/packages/toolpad-app/tsup.config.ts @@ -53,6 +53,7 @@ export default defineConfig([ silent: true, outDir: 'dist/runtime', tsconfig: './tsconfig.esbuild.json', + clean: true, async onSuccess() { // eslint-disable-next-line no-console console.log('runtime: build successful');