From febbc4629c44b7529484151a29bb15eec491211c Mon Sep 17 00:00:00 2001 From: shaoyu Date: Sat, 24 Jul 2021 10:10:08 -0500 Subject: [PATCH 1/2] fix no-code-demo --- examples/no-code/vite.config.ts | 47 --------------------------------- 1 file changed, 47 deletions(-) diff --git a/examples/no-code/vite.config.ts b/examples/no-code/vite.config.ts index a5c06b7a4b9..98d798f2a81 100644 --- a/examples/no-code/vite.config.ts +++ b/examples/no-code/vite.config.ts @@ -1,54 +1,7 @@ import { defineConfig } from 'vite'; import reactRefresh from '@vitejs/plugin-react-refresh'; -import path from 'path'; // https://vitejs.dev/config/ export default defineConfig({ plugins: [reactRefresh()], - alias: [ - { - find: /^react-admin$/, - replacement: path.resolve( - __dirname, - '../../packages/react-admin/src' - ), - }, - { - find: /^ra-core$/, - replacement: path.resolve(__dirname, '../../packages/ra-core/src'), - }, - { - find: /^ra-ui-materialui$/, - replacement: path.resolve( - __dirname, - '../../packages/ra-ui-materialui/src' - ), - }, - { - find: /^ra-data-local-storage$/, - replacement: path.resolve( - __dirname, - '../../packages/ra-data-localstorage/src' - ), - }, - { - find: /^ra-no-code$/, - replacement: path.resolve( - __dirname, - '../../packages/ra-no-code/src' - ), - }, - { - find: /^@material-ui\/icons\/(.*)/, - replacement: '@material-ui/icons/esm/$1', - }, - { - find: /^@material-ui\/core\/(.+)/, - replacement: '@material-ui/core/es/$1', - }, - { - find: /^@material-ui\/core$/, - replacement: '@material-ui/core/es', - }, - ], }); From eada714c335705229f41f5dff32e263bf501bf93 Mon Sep 17 00:00:00 2001 From: Shaoyu Date: Tue, 9 Nov 2021 15:03:40 -0600 Subject: [PATCH 2/2] add environment detection for codesandbox --- examples/no-code/vite.config.ts | 52 +++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/examples/no-code/vite.config.ts b/examples/no-code/vite.config.ts index 98d798f2a81..99ec2943f31 100644 --- a/examples/no-code/vite.config.ts +++ b/examples/no-code/vite.config.ts @@ -1,7 +1,59 @@ import { defineConfig } from 'vite'; import reactRefresh from '@vitejs/plugin-react-refresh'; +import path from 'path'; // https://vitejs.dev/config/ export default defineConfig({ plugins: [reactRefresh()], + alias: process.env.CODESANDBOX_SSE + ? [] + : [ + { + find: /^react-admin$/, + replacement: path.resolve( + __dirname, + '../../packages/react-admin/src' + ), + }, + { + find: /^ra-core$/, + replacement: path.resolve( + __dirname, + '../../packages/ra-core/src' + ), + }, + { + find: /^ra-ui-materialui$/, + replacement: path.resolve( + __dirname, + '../../packages/ra-ui-materialui/src' + ), + }, + { + find: /^ra-data-local-storage$/, + replacement: path.resolve( + __dirname, + '../../packages/ra-data-localstorage/src' + ), + }, + { + find: /^ra-no-code$/, + replacement: path.resolve( + __dirname, + '../../packages/ra-no-code/src' + ), + }, + { + find: /^@material-ui\/icons\/(.*)/, + replacement: '@material-ui/icons/esm/$1', + }, + { + find: /^@material-ui\/core\/(.+)/, + replacement: '@material-ui/core/es/$1', + }, + { + find: /^@material-ui\/core$/, + replacement: '@material-ui/core/es', + }, + ], });