Skip to content

Commit

Permalink
use createRequire
Browse files Browse the repository at this point in the history
  • Loading branch information
etrepum committed May 3, 2024
1 parent c5910f2 commit 6a00ace
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions packages/lexical-playground/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@

import babel from '@rollup/plugin-babel';
import react from '@vitejs/plugin-react';
import {createRequire} from 'node:module';
import {defineConfig} from 'vite';
import {replaceCodePlugin} from 'vite-plugin-replace';

import moduleResolution from '../shared/viteModuleResolution';
import viteCopyEsm from './viteCopyEsm';

const require = createRequire(import.meta.url);

// https://vitejs.dev/config/
export default defineConfig({
build: {
Expand Down
6 changes: 5 additions & 1 deletion packages/shared/viteModuleResolution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ import type {
PackageMetadata,
} from '../../scripts/shared/PackageMetadata';

import {packagesManager} from '../../scripts/shared/packagesManager';
import {createRequire} from 'node:module';

const require = createRequire(import.meta.url);
const {packagesManager} =
require('../../scripts/shared/packagesManager') as typeof import('../../scripts/shared/packagesManager');

function toAlias(pkg: PackageMetadata, entry: ModuleExportEntry) {
return {
Expand Down

0 comments on commit 6a00ace

Please sign in to comment.