Skip to content

Commit e202cef

Browse files
committed
ESM updates
1 parent 75b73ae commit e202cef

File tree

1 file changed

+7
-3
lines changed
  • packages/redux-devtools-ui/.storybook

1 file changed

+7
-3
lines changed

packages/redux-devtools-ui/.storybook/main.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
import type { StorybookConfig } from '@storybook/react-webpack5';
22

3-
import { join, dirname } from 'path';
3+
import { dirname } from 'node:path';
4+
import { fileURLToPath } from 'node:url';
45

56
/**
67
* This function is used to resolve the absolute path of a package.
78
* It is needed in projects that use Yarn PnP or are set up within a monorepo.
89
*/
9-
function getAbsolutePath(value: string): any {
10-
return dirname(require.resolve(join(value, 'package.json')));
10+
function getAbsolutePath(packageName: string) {
11+
return dirname(
12+
fileURLToPath(import.meta.resolve(`${packageName}/package.json`)),
13+
);
1114
}
15+
1216
const config: StorybookConfig = {
1317
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
1418
addons: [getAbsolutePath('@storybook/addon-onboarding')],

0 commit comments

Comments
 (0)