diff --git a/packages/lexical-playground/vite.config.ts b/packages/lexical-playground/vite.config.ts index 98a5d6b35c0..5e6f3ff8758 100644 --- a/packages/lexical-playground/vite.config.ts +++ b/packages/lexical-playground/vite.config.ts @@ -11,6 +11,7 @@ import react from '@vitejs/plugin-react'; import {defineConfig} from 'vite'; import {replaceCodePlugin} from 'vite-plugin-replace'; +import viteCopyEsm from './viteCopyEsm'; import moduleResolution from './viteModuleResolution'; // https://vitejs.dev/config/ @@ -54,6 +55,7 @@ export default defineConfig({ presets: ['@babel/preset-react'], }), react(), + viteCopyEsm(), ], resolve: { alias: moduleResolution, diff --git a/packages/lexical-playground/vite.prod.config.ts b/packages/lexical-playground/vite.prod.config.ts index 893a2d35037..c0276678a4a 100644 --- a/packages/lexical-playground/vite.prod.config.ts +++ b/packages/lexical-playground/vite.prod.config.ts @@ -11,6 +11,7 @@ import react from '@vitejs/plugin-react'; import {defineConfig} from 'vite'; import {replaceCodePlugin} from 'vite-plugin-replace'; +import viteCopyEsm from './viteCopyEsm'; import moduleResolution from './viteModuleResolution'; // https://vitejs.dev/config/ @@ -53,6 +54,7 @@ export default defineConfig({ presets: ['@babel/preset-react'], }), react(), + viteCopyEsm(), ], resolve: { alias: moduleResolution, diff --git a/packages/lexical-playground/viteCopyEsm.ts b/packages/lexical-playground/viteCopyEsm.ts new file mode 100644 index 00000000000..9dabd1bcda5 --- /dev/null +++ b/packages/lexical-playground/viteCopyEsm.ts @@ -0,0 +1,41 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + */ +import * as fs from 'node:fs'; +import * as path from 'node:path'; +import copy from 'rollup-plugin-copy'; + +function parseImportMapImportEntries() { + const m = /