Skip to content

feat: migrate from webpack to vite in storybook#680

Open
Filipoliko wants to merge 1 commit into
vitefrom
cnsqa-2223
Open

feat: migrate from webpack to vite in storybook#680
Filipoliko wants to merge 1 commit into
vitefrom
cnsqa-2223

Conversation

@Filipoliko

Copy link
Copy Markdown
Contributor

No description provided.

@changeset-bot

changeset-bot Bot commented Apr 30, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: d67a45f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@Filipoliko Filipoliko force-pushed the cnsqa-2223 branch 3 times, most recently from 03d1aa8 to 7e21c9b Compare April 30, 2026 14:10
@Filipoliko Filipoliko marked this pull request as ready for review May 4, 2026 12:32
@Filipoliko Filipoliko requested a review from Copilot May 4, 2026 12:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Migrates @ima/storybook-integration from the old webpack-based Storybook integration to a Vite-based preset that reuses the new @ima/cli Vite pipeline. This keeps Storybook aligned with the codebase’s broader Vite migration while updating the integration’s docs, dependencies, and packaging.

Changes:

  • Replace webpackFinal/webpack resolver helpers with a new viteFinal + previewAnnotations preset flow.
  • Reuse @ima/cli Vite config pieces, including virtual locale modules and injected $IMA revival settings.
  • Update Storybook package metadata, docs, and lockfile dependencies for the Vite-based setup.

Reviewed changes

Copilot reviewed 12 out of 13 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/storybook-integration/tsconfig.json Removes webpack ambient types from the package TS config.
packages/storybook-integration/src/types.ts Switches Storybook type imports/module augmentation to Storybook 10 internal types.
packages/storybook-integration/src/presets/resolvers.ts Deletes webpack-specific resolver utilities.
packages/storybook-integration/src/preset.ts Replaces webpack preset logic with Vite preset hooks and locale/HTML injection.
packages/storybook-integration/src/loaders/imaLoader.ts Tightens cached IMA parameter typing and reload-key handling.
packages/storybook-integration/README.md Rewrites setup instructions for Storybook + Vite usage.
packages/storybook-integration/package.json Swaps webpack-related Storybook deps/peers for Vite-related ones.
packages/storybook-integration/.npmignore Limits published contents to built artifacts.
packages/plugin-cli/package.json Bumps direct rolldown dependency.
packages/cli/src/index.ts Re-exports virtual locale helpers needed by Storybook integration.
packages/cli/package.json Bumps Vite version used by the CLI.
package.json Reorders workspace entries.
package-lock.json Locks the Storybook/Vite/Rolldown dependency updates.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +44 to +51
* Prefers the explicit `language` option, falls back to the first language
* defined in imaConfig, then 'en'.
*/
function resolveLanguage(
imaConfig: Awaited<ReturnType<typeof resolveImaConfig>>,
options: Pick<ViteFinalOptions, 'language'>
): string {
return options.language ?? Object.keys(imaConfig.languages ?? {})[0] ?? 'en';
Comment on lines +64 to +66
const oldEnv = process.env.NODE_ENV;
process.env.NODE_ENV = 'regression';
const env = resolveEnvironment(rootDir);
],
```

### 4. Import the preview setup in `.storybook/preview.js`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants