diff --git a/.nvmrc b/.nvmrc index bb8c76c68e2..d819d013d15 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -v22.11.0 +v23.8.0 diff --git a/.storybook/main.ts b/.storybook/main.ts index bb0f3774009..303b7d66a98 100644 --- a/.storybook/main.ts +++ b/.storybook/main.ts @@ -1,9 +1,17 @@ -import path from 'path'; +import { createRequire } from 'module'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; import fg from 'fast-glob'; import TsconfigPathsPlugin from 'tsconfig-paths-webpack-plugin'; import yargs from 'yargs'; import { hideBin } from 'yargs/helpers'; +const currentModuleUrl = typeof import.meta !== 'undefined' ? import.meta.url : ''; +const __filename = fileURLToPath(currentModuleUrl); +const __dirname = path.dirname(__filename); + +const nodeRequire = createRequire(currentModuleUrl); + const { argv } = yargs(hideBin(process.argv)); if (argv instanceof Promise) { @@ -15,7 +23,7 @@ const getGlobPaths = (paths: string[]) => paths.reduce((acc, path) => [...acc, ...fg.sync(path)], []); function getAbsolutePath(value: string) { - return path.dirname(require.resolve(path.join(value, 'package.json'))); + return path.dirname(nodeRequire.resolve(path.join(value, 'package.json'))); } function getStoryPaths(fileName: string | number = '*') {