-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
SB10: ESM-only #31819
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
ndelangen
wants to merge
222
commits into
next
Choose a base branch
from
sb10/esm-only
base: next
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
SB10: ESM-only #31819
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…upport - Changed Storybook UI commands in package.json to reference core/bin instead of node_modules/storybook. - Updated package.json in core to use 'default' for common module exports. - Introduced hooks.mjs and loader.mjs for improved ESM handling and TypeScript support. - Modified interopRequireDefault function to handle dynamic imports and fallback to CommonJS.
…async operations - Changed `loadCustomPresets` and `loadCustomWebpackConfig` functions to be asynchronous, allowing for better handling of dynamic imports. - Updated the usage of these functions in the relevant files to await their results, ensuring proper configuration loading. - Removed deprecated `esbuild-register` dependency from package.json.
- Bump Node.js version requirement to 22.16.0 in package.json. - Update .nvmrc to reflect the new Node.js version. - Add esbuild dependency version range to package.json and yarn.lock. - Modify getStorybookInfo calls to be asynchronous in relevant files for better handling of dynamic imports. - Introduce new hooks.mjs and loader.mjs for enhanced ESM support and TypeScript handling.
- Introduced hooks.mjs and loader.mjs for enhanced ESM handling and TypeScript transformation. - Updated index.cjs to utilize the new hooks for loading TypeScript files. - Included bin/**/* in package.json to ensure proper file inclusion.
- Added `./bin/loader.mjs` export to package.json for improved module resolution. - Removed deprecated `hooks.mjs` files from bin directories. - Updated `index.cjs` to directly require the dist files, simplifying the loading process. - Adjusted `generatePackageJsonFile` to handle new export formats for core-server presets. - Replaced `require.resolve` with `import.meta.resolve` in multiple files for better ESM compatibility.
- Enhanced the `preset` object in `presets.test.ts` to include detailed properties for better testing coverage. - Marked the `should resolve all addons & presets in correct order` test as skipped in `presets.test.ts` to prevent execution during current test runs. - Updated `build-index.test.ts` to skip the `should build index` test, indicating a temporary change in test execution status.
…istency - Added `defaultFavicon` constant to `constants.ts` for better favicon management. - Updated `common-preset.ts` to import `defaultFavicon`. - Modified tests in `favicon.test.ts`, `stories-json.test.ts`, and `StoryIndexGenerator.test.ts` to mock `defaultFavicon` and `defaultStaticDirs` for consistent test behavior.
- Updated `standalone.ts` and `common-preset.ts` to replace `import.meta.resolve` with `fileURLToPath` for better ESM support. - Ensured correct directory resolution for package.json files in both modules.
- Updated `build-static.ts` to use `fileURLToPath` for resolving the directory of `package.json`, improving ESM support. - This change aligns with recent updates to other files for consistent handling of module paths.
…patibility - Changed the export in `package.json` from `require` to `default` for telemetry. - Enhanced the `generatePackageJsonFile` function to include additional checks for ESM-only compatibility, specifically for telemetry files.
…ibility - Changed the loader resolution in `sandbox-parts.ts` from `import.meta.resolve` to a direct string reference for `@storybook/addon-docs/mdx-loader`, improving consistency with recent ESM updates.
- Eliminated the esbuild version range from `package.json` files in `cli-storybook` and `create-storybook`, as well as from `yarn.lock`, to streamline dependency management and avoid potential conflicts.
- Updated the CircleCI configuration file to use consistent double quotes for strings, enhancing readability and maintaining uniformity across the configuration.
…le extensions - Updated the loader function in `loader.mjs` to recognize and process multiple TypeScript file extensions, including `.mts`, `.cts`, `.mtsx`, and `.ctsx`, improving compatibility with various TypeScript module formats.
- Changed the version of `@storybook/test-runner` in `sandbox-parts.ts` from `0.22.1--canary.d4862d0.0` to `0.23.1--canary.fd3c654.0` to incorporate the latest features and fixes.
- Corrected the package name from `storybook/test-runner` to `@storybook/test-runner` in `sandbox-parts.ts` to ensure proper dependency resolution.
- Changed the version of `@storybook/test-runner` from `0.23.1--canary.fd3c654.0` to `0.23.1--canary.b6bd5f6.0` in `sandbox-parts.ts` to incorporate the latest updates.
- Added a new step in the CircleCI configuration to install Node.js version 22.15.0 using NVM, ensuring the correct Node version is used during the build process.
- Modified the Node.js installation step in the CircleCI config to use wget instead of curl, and added commands to set up NVM environment variables for better compatibility and reliability during builds.
- Changed the Node.js installation step in the CircleCI config to use version 22.16.0, ensuring the build process utilizes the latest features and improvements.
…e node-logger and client-logger to ESM only
- Set `minifyWhitespace` to `false` in `bundle.ts` to prevent whitespace minification during the build process. - Updated the version of `@storybook/test-runner` in `sandbox-parts.ts` from `0.23.1--canary.b6bd5f6.0` to `0.23.1--canary.2094e4b.0` to incorporate the latest updates.
- Updated the version of `@storybook/test-runner` in `sandbox-parts.ts` from `0.23.1--canary.2094e4b.0` to `0.23.1--canary.49024ff.0` to incorporate the latest updates.
- Updated the version of `@storybook/test-runner` in `sandbox-parts.ts` from `0.23.1--canary.49024ff.0` to `0.23.1--canary.de6531a.0` to incorporate the latest updates.
…s/storybook into jeppe/migrate-core-esm-only-5
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Core: ESM-only-fi manager-related entry points
…to a directory root that can only be `require`d
Core: Migrate CLI and bins to ESM-only
Core: Remove `typesVersions` field from core
Core: Only support ESM version of getAbsolutePath
…e-flags-monorepo Build: Remove NODE_OPTIONS flags for symlinks in main storybook
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
ci: do not merge
ci:merged
Run the CI jobs that normally run when merged.
core
esm
maintenance
User-facing maintenance tasks
modern
other
presets
typescript
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What I did
This is the target branch of all ESM-only related work for Storybook v10
🦋 Canary release
This pull request has been released as version
0.0.0-pr-31819-sha-8b752a73
. Try it out in a new sandbox by runningnpx storybook@0.0.0-pr-31819-sha-8b752a73 sandbox
or in an existing project withnpx storybook@0.0.0-pr-31819-sha-8b752a73 upgrade
.More information
0.0.0-pr-31819-sha-8b752a73
sb10/esm-only
8b752a73
1751049429
)To request a new release of this pull request, mention the
@storybookjs/core
team.core team members can create a new canary release here or locally with
gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=31819
Greptile Summary
Target branch for transitioning Storybook v10 to ESM-only modules, marking a significant architectural shift in package format and module system.
@storybookjs/core
team mention