Skip to content

Test: Remove source map generation from webpack automock-loader#32115

Merged
valentinpalkovic merged 1 commit intonextfrom
valentin/remove-source-map-generation-from-webpack-automock-loader
Jul 24, 2025
Merged

Test: Remove source map generation from webpack automock-loader#32115
valentinpalkovic merged 1 commit intonextfrom
valentin/remove-source-map-generation-from-webpack-automock-loader

Conversation

@valentinpalkovic
Copy link
Copy Markdown
Contributor

@valentinpalkovic valentinpalkovic commented Jul 24, 2025

Closes #

What I did

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli-storybook/src/sandbox-templates.ts

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

🦋 Canary release

This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

core team members can create a canary release here or locally with gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=<PR_NUMBER>

Greptile Summary

This PR simplifies the webpack automock loader by removing source map generation. The change converts the loader from using Webpack's asynchronous callback pattern (this.async() and callback()) to a synchronous return pattern. Previously, the loader would call callback(null, mocked.toString(), mocked.generateMap()) to return both the transformed code and source maps. Now it directly returns mocked.toString(), eliminating source map generation entirely.

The automock functionality itself remains unchanged - the getAutomockCode function from @vitest/mocker still handles the core transformation logic for creating mocked modules. This loader is part of Storybook's webpack preprocessing pipeline and is used to automatically generate mocks for modules during testing scenarios. The change streamlines the loader implementation by removing unnecessary complexity around source map handling, which may not be critical for automocked test modules.

PR Description Notes:

  • The "What I did" section is empty and should describe the change
  • No testing approach is specified in the manual testing section
  • The PR doesn't reference a specific issue number

Confidence score: 4/5

  • This change is relatively safe as it simplifies the loader without affecting core functionality
  • The risk is primarily around potential debugging difficulties due to missing source maps, but this is acceptable for test automation contexts
  • The file code/core/src/core-server/presets/webpack/loaders/webpack-automock-loader.ts should be reviewed to ensure the synchronous pattern works correctly with webpack's loader API

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, no comments

Edit Code Review Bot Settings | Greptile

@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Jul 24, 2025

View your CI Pipeline Execution ↗ for commit d901add

Command Status Duration Result
nx run-many -t check -c production --parallel=7 ✅ Succeeded 1s View ↗
nx run-many -t build -c production --parallel=3 ✅ Succeeded 2s View ↗

☁️ Nx Cloud last updated this comment at 2025-07-24 09:57:20 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants