From beedffb1362b9b532d05cf512dee9f46ccd235e0 Mon Sep 17 00:00:00 2001 From: sangwook Date: Wed, 11 Jun 2025 07:37:54 +0900 Subject: [PATCH 1/2] [bug] Refactor Storybook main config for ESM compatibility. Updated imports and path resolution to align with ES module standards, replacing CommonJS-specific methods. This ensures compatibility with modern JavaScript tooling while maintaining functionality. --- .storybook/main.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.storybook/main.ts b/.storybook/main.ts index bb0f3774009..824ac66a5af 100644 --- a/.storybook/main.ts +++ b/.storybook/main.ts @@ -1,8 +1,16 @@ -import path from 'path'; +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'; +import { createRequire } from 'module'; + +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)); @@ -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 = '*') { From afbe48d03550fffa452616318f008cb42234bd39 Mon Sep 17 00:00:00 2001 From: sangwook Date: Wed, 11 Jun 2025 07:53:54 +0900 Subject: [PATCH 2/2] [core] Update to node 23 --- .nvmrc | 2 +- .storybook/main.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 824ac66a5af..303b7d66a98 100644 --- a/.storybook/main.ts +++ b/.storybook/main.ts @@ -1,10 +1,10 @@ +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'; -import { createRequire } from 'module'; const currentModuleUrl = typeof import.meta !== 'undefined' ? import.meta.url : ''; const __filename = fileURLToPath(currentModuleUrl);